Module: ActiveHash::ARApi::Init

Included in:
ActiveMocker::ActiveHash::ARApi
Defined in:
lib/active_hash/init.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#associationsObject (readonly)

Returns the value of attribute associations.



7
8
9
# File 'lib/active_hash/init.rb', line 7

def associations
  @associations
end

#typesObject (readonly)

Returns the value of attribute types.



7
8
9
# File 'lib/active_hash/init.rb', line 7

def types
  @types
end

Instance Method Details

#initialize(attributes = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_hash/init.rb', line 9

def initialize(attributes = {}, &block)
  @types = {}
  yield self if block_given?
  attributes.each do |key, value|
    begin
      send "#{key}=", value
    rescue NoMethodError
      raise ActiveMocker::RejectedParams, "{:#{key}=>#{value.inspect}} for #{self.class.name}"
    end
  end

end