Module: StrongStruct::InstanceMethods

Defined in:
lib/strong_struct.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



30
31
32
33
34
35
36
# File 'lib/strong_struct.rb', line 30

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

#initialize(params = {}) ⇒ Object



24
25
26
27
28
# File 'lib/strong_struct.rb', line 24

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