Sha256: e458b5d8ed79d8e57fa025f9d8a32d0fc03aa3ffd09c615da11ee04361bce3f2

Contents?: true

Size: 1.54 KB

Versions: 18

Compression:

Stored size: 1.54 KB

Contents

require 'backports/tools/deprecation'

Backports.deprecate :rails, 'Rails backports are deprecated.'

class Hash
  # Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
  def reverse_merge(other_hash)
    other_hash.merge(self)
  end unless method_defined? :reverse_merge

  # Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
  def reverse_merge!(other_hash)
    replace(reverse_merge(other_hash))
  end unless method_defined? :reverse_merge!

  # Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
  def symbolize_keys
    Hash[map{|key,value| [(key.to_sym rescue key) || key, value] }]
  end unless method_defined? :symbolize_keys

  # Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
  def symbolize_keys!
    self.replace(self.symbolize_keys)
  end unless method_defined? :symbolize_keys!

  # Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
  def stringify_keys
    Hash[map{|key,value| [key.to_s, value] }]
  end unless method_defined? :stringify_keys

  # Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
  def stringify_keys!
    self.replace(self.stringify_keys)
  end unless method_defined? :stringify_keys!
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
backports-3.25.0 lib/backports/rails/hash.rb
backports-3.24.1 lib/backports/rails/hash.rb
backports-3.24.0 lib/backports/rails/hash.rb
backports-3.23.0 lib/backports/rails/hash.rb
backports-3.22.1 lib/backports/rails/hash.rb
backports-3.22.0 lib/backports/rails/hash.rb
backports-3.21.0 lib/backports/rails/hash.rb
backports-3.20.2 lib/backports/rails/hash.rb
backports-3.20.1 lib/backports/rails/hash.rb
backports-3.20.0 lib/backports/rails/hash.rb
backports-3.19.0 lib/backports/rails/hash.rb
backports-3.18.2 lib/backports/rails/hash.rb
backports-3.18.1 lib/backports/rails/hash.rb
backports-3.18.0 lib/backports/rails/hash.rb
backports-3.17.2 lib/backports/rails/hash.rb
backports-3.17.1 lib/backports/rails/hash.rb
backports-3.17.0 lib/backports/rails/hash.rb
backports-3.16.1 lib/backports/rails/hash.rb