Method: Steem::Serializable::ClassMethods#def_attr

Defined in:
lib/steem/mixins/serializable.rb

#def_attr(key_pair) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/steem/mixins/serializable.rb', line 12

def def_attr key_pair
  name = key_pair.keys.first.to_sym
  type = key_pair.values.first.to_sym
  
  self.attributes ||= []
  self.attributes << name
  
  attr_accessor *attributes
  add_type name, type
end