class Object
Constants
- SP_ADD_TO_RUBY
Public Instance Methods
deep_symbolize_keys()
click to toggle source
symbolize hash of arrays and array of hashes Taken from gist gist.github.com/Integralist/9503099 Thanks to @integralist
# File lib/nice/hash/add_to_ruby.rb, line 302 def deep_symbolize_keys if is_a? Hash return reduce({}) do |memo, (k, v)| memo.tap { |m| m[k.to_sym] = v.deep_symbolize_keys } end end if is_a? Array return each_with_object([]) do |v, memo| memo << v.deep_symbolize_keys end end self end
in?(array)
click to toggle source
include? but the opposite. Check if the object is included on the array
# File lib/nice/hash/add_to_ruby.rb, line 320 def in?(array) array.include?(self) end