def ruby_code(obj)
case obj
when String then '%q{' + obj + '}'
when Array then obj.inspect
when Gem::Version then obj.to_s.inspect
when Date then '%q{' + obj.strftime('%Y-%m-%d') + '}'
when Time then '%q{' + obj.strftime('%Y-%m-%d') + '}'
when Numeric then obj.inspect
when true, false, nil then obj.inspect
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
when Gem::Requirement then "Gem::Requirement.new(#{obj.to_s.inspect})"
else raise Exception, "ruby_code case not handled: #{obj.class}"
end
end