Class: ActiveEntity::Store::HashAccessor
- Inherits:
-
Object
- Object
- ActiveEntity::Store::HashAccessor
show all
- Defined in:
- lib/active_entity/store.rb
Overview
Class Method Summary
collapse
Class Method Details
.prepare(object, attribute) ⇒ Object
235
236
237
|
# File 'lib/active_entity/store.rb', line 235
def self.prepare(object, attribute)
object.public_send :"#{attribute}=", {} unless object.send(attribute)
end
|
.read(object, attribute, key) ⇒ Object
222
223
224
225
|
# File 'lib/active_entity/store.rb', line 222
def self.read(object, attribute, key)
prepare(object, attribute)
object.public_send(attribute)[key]
end
|
.write(object, attribute, key, value) ⇒ Object
227
228
229
230
231
232
233
|
# File 'lib/active_entity/store.rb', line 227
def self.write(object, attribute, key, value)
prepare(object, attribute)
if value != read(object, attribute, key)
object.public_send :"#{attribute}_will_change!"
object.public_send(attribute)[key] = value
end
end
|