instance method
key_value
Ruby on Rails 3.2.22.5
Since v3.1.12 Last seen in v3.2.22.5Available in: v3.1.12 v3.2.22.5
Signature
key_value(key, value)
Returns Ruby 1.9 style key-value pair if current code is running on Ruby 1.9.x. Returns the old-style (with hash rocket) otherwise.
Parameters
-
keyreq -
valuereq
Source
# File railties/lib/rails/generators/named_base.rb, line 193
def key_value(key, value)
if options[:old_style_hash] || RUBY_VERSION < '1.9'
":#{key} => #{value}"
else
"#{key}: #{value}"
end
end
Defined in railties/lib/rails/generators/named_base.rb line 193
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generators::NamedBase