Module: AttributeHelper

Included in:
Trip
Defined in:
lib/blabla_client/attribute_helper.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



8
9
10
# File 'lib/blabla_client/attribute_helper.rb', line 8

def attributes
  Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }]
end

#attributes=(hash) ⇒ Object



2
3
4
5
6
# File 'lib/blabla_client/attribute_helper.rb', line 2

def attributes=(hash)
  hash.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end