Method: Vk::Base#initialize
- Defined in:
- lib/vk/base.rb
#initialize(id, options = {}) ⇒ Base
Returns a new instance of Base.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vk/base.rb', line 59 def initialize(id, = {}) @attributes = ActiveSupport::HashWithIndifferentAccess.new if id.is_a?(Hash) [:data] = id id = [:data][key_field.to_s] end self.id = id self.class.identity_map[id] = self if .key? :data @attributes.merge!([:data].with_indifferent_access) else load_data() end end |