Class: Struct

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

Instance Method Summary collapse

Instance Method Details

#attributesObject



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

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

#replace(args) ⇒ Object



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

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