Sha256: b2db7dae36445a26795a619b2069b8bf1427314b5c8c047192643b33150e9e1c

Contents?: true

Size: 251 Bytes

Versions: 4

Compression:

Stored size: 251 Bytes

Contents

# Method to switch keys and values of an ordered hash.
# origin: RM
ActiveSupport::OrderedHash.class_eval do

  def invert
    inject(ActiveSupport::OrderedHash.new) do |res, pair|
      res[pair[1]] = pair[0]
      res
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/config/initializers/invert_ordered_hash.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/config/initializers/invert_ordered_hash.rb
serum-rails-0.1.1 spec/test_app/config/initializers/invert_ordered_hash.rb
serum-rails-0.1.0 spec/test_app/config/initializers/invert_ordered_hash.rb