Class: Struct

Inherits:
Object show all
Defined in:
lib/lite/ruby/struct.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



5
6
7
# File 'lib/lite/ruby/struct.rb', line 5

def attributes
  each_pair.with_object({}) { |(key, val), hash| hash[key] = val }
end

#replace(args) ⇒ Object



9
10
11
# File 'lib/lite/ruby/struct.rb', line 9

def replace(args)
  args.each_pair { |key, val| self[key] = val }
end