Method: Zephyrus::Base#initialize
- Defined in:
- lib/zephyrus/resources/base.rb
#initialize(attributes = {}, associations = {}) {|_self| ... } ⇒ Base
Returns a new instance of Base.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/zephyrus/resources/base.rb', line 54 def initialize( attributes = {}, associations = {} ) self.type_name = self.class.name.gsub( /Zephyrus::/, '' ).underscore attributes.each do | key, value | send( "#{key}=", value ) if respond_to?( "#{key}=" ) end associations.each do | key, value | self.instance_variable_set( "@_#{key}", value ) end yield self if block_given? end |