instance method key_value

Ruby on Rails 3.1.12

Since v3.1.12 Last seen in v3.2.22.5

Available 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

key req
value req
Source
# File railties/lib/rails/generators/named_base.rb, line 192
        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 192 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Generators::NamedBase

Type at least 2 characters to search.

↑↓ navigate · open · esc close