123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::Store::HashAccessor

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: activerecord/lib/active_record/store.rb

Class Method Summary

Class Method Details

.get(store_object, key)

[ GitHub ]

  
# File 'activerecord/lib/active_record/store.rb', line 234

def self.get(store_object, key)
  if store_object
    store_object[key]
  end
end

.prepare(object, attribute)

[ GitHub ]

  
# File 'activerecord/lib/active_record/store.rb', line 250

def self.prepare(object, attribute)
  store_object = object.public_send(attribute)

  if store_object.nil?
    store_object = {}
    object.public_send(:"#{attribute}=", store_object)
  end

  store_object
end

.read(object, attribute, key)

[ GitHub ]

  
# File 'activerecord/lib/active_record/store.rb', line 240

def self.read(object, attribute, key)
  store_object = prepare(object, attribute)
  store_object[key]
end

.write(object, attribute, key, value)

[ GitHub ]

  
# File 'activerecord/lib/active_record/store.rb', line 245

def self.write(object, attribute, key, value)
  store_object = prepare(object, attribute)
  store_object[key] = value if value != store_object[key]
end