Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/googleajax/extensions/hash.rb

Direct Known Subclasses

GoogleAjax::Hash

Class Method Summary collapse

Class Method Details

.[](*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/googleajax/extensions/hash.rb', line 8

def [](*args)
  return constructor_without_key_value_pair_form(*args) unless args.length == 1 && args.first.is_a?(Array)
  h = {}
  args.first.each do |arr|
    next unless arr.respond_to? :to_ary
    arr = arr.to_ary
    next unless (1..2).include? arr.size
    h[arr.at(0)] = arr.at(1)
  end
  h
end

.constructor_without_key_value_pair_formObject



7
# File 'lib/googleajax/extensions/hash.rb', line 7

alias_method :constructor_without_key_value_pair_form, :[]