Module: Vattributes::Extension

Extended by:
ActiveSupport::Concern
Defined in:
lib/vattributes/extension.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#vattribute_get(name) ⇒ Object



9
10
11
# File 'lib/vattributes/extension.rb', line 9

def vattribute_get(name)
  self.virtual_attributes[name.to_s]
end

#vattribute_set(name, value) ⇒ Object



13
14
15
# File 'lib/vattributes/extension.rb', line 13

def vattribute_set(name, value)
  self.vattributes = self.virtual_attributes.merge({ name.to_s => value })
end

#virtual_attributesObject



17
18
19
# File 'lib/vattributes/extension.rb', line 17

def virtual_attributes
  read_attribute(:vattributes) || {}
end