Create a hash from an array of keys and corresponding values.
# File lib/gorillib/hash/zip.rb, line 5 def self.zip(keys, values, default=nil, &block) hash = block_given? ? Hash.new(&block) : Hash.new(default) keys.zip(values){|key,val| hash[key]=val } hash end
By default, only instances of Hash itself are extractable. Subclasses of Hash may implement this method and return true to declare themselves as extractable. If a Hash is extractable, Array#extract_options! pops it from the Array when it is the last element of the Array.
# File lib/gorillib/array/extract_options.rb, line 7 def extractable_options? instance_of?(Hash) end
Convert to Mash. This class has semantics of ActiveSupport’s HashWithIndifferentAccess and we only have it so that people can write params instead of params.
@return [Mash] This hash as a Mash for string or symbol key access.
# File lib/gorillib/hash/mash.rb, line 8 def to_mash hsh = Mash.new(self) hsh.default = default hsh end
Generated with the Darkfish Rdoc Generator 2.