Class: Hash

Inherits:
Object show all
Includes:
Sink
Defined in:
lib/coroutines.rb

Instance Method Summary collapse

Methods included from Sink

#<=, #close, #input_map, #input_reduce, #input_reject, #input_select

Instance Method Details

#<<(args) ⇒ Object

:call-seq:

hash << [key, value] -> hash

Equivalent to hash = value, but allows chaining:

{} << [1, "one"] << [2, "two"] << [3, "three"]  #=> {1=>"one", 2=>"two", 3=>"three"}


54
55
56
57
# File 'lib/coroutines.rb', line 54

def <<(args)
  self[args[0]] = args[1]
  self
end