Module: StrongStruct::InstanceMethods

Defined in:
lib/strong_struct.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



25
26
27
28
29
30
31
# File 'lib/strong_struct.rb', line 25

def attributes
  hash = {}
  accessors.each do |attr|
    hash[attr] = send(attr)
  end
  hash
end

#initialize(params = {}) ⇒ Object



19
20
21
22
23
# File 'lib/strong_struct.rb', line 19

def initialize(params = {})
  params.each do |attr, value|
    send "#{attr}=", value
  end if params
end