Sha256: c9c0b400e89a01b5ac26d97fc9169da8cb7dc0f3d5f1cf4aa56caddc543193a4

Contents?: true

Size: 1.44 KB

Versions: 53

Compression:

Stored size: 1.44 KB

Contents

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

53 entries across 53 versions & 5 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/backports-3.12.0/lib/backports/rails/hash.rb
backports-3.16.0 lib/backports/rails/hash.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/backports-3.15.0/lib/backports/rails/hash.rb
backports-3.15.0 lib/backports/rails/hash.rb
backports-3.14.0 lib/backports/rails/hash.rb
backports-3.13.0 lib/backports/rails/hash.rb
backports-3.12.0 lib/backports/rails/hash.rb
backports-3.11.4 lib/backports/rails/hash.rb
backports-3.11.3 lib/backports/rails/hash.rb
backports-3.11.2 lib/backports/rails/hash.rb
backports-3.11.1 lib/backports/rails/hash.rb
backports-3.11.0 lib/backports/rails/hash.rb
backports-3.10.3 lib/backports/rails/hash.rb
backports-3.10.2 lib/backports/rails/hash.rb
backports-3.10.1 lib/backports/rails/hash.rb
backports-3.10.0 lib/backports/rails/hash.rb
backports-3.9.1 lib/backports/rails/hash.rb
backports-3.9.0 lib/backports/rails/hash.rb
backports-3.8.0 lib/backports/rails/hash.rb
backports-3.7.0 lib/backports/rails/hash.rb