Class: ActsAsMultilingual::AttributeProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_multilingual/attribute_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, column) ⇒ AttributeProxy

Returns a new instance of AttributeProxy.



5
6
7
8
# File 'lib/acts_as_multilingual/attribute_proxy.rb', line 5

def initialize(owner, column)
  @owner = owner
  @column = column
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



3
4
5
# File 'lib/acts_as_multilingual/attribute_proxy.rb', line 3

def column
  @column
end

#ownerObject (readonly)

Returns the value of attribute owner.



3
4
5
# File 'lib/acts_as_multilingual/attribute_proxy.rb', line 3

def owner
  @owner
end

Instance Method Details

#read(locale) ⇒ Object



10
11
12
# File 'lib/acts_as_multilingual/attribute_proxy.rb', line 10

def read(locale)
  owner[column][locale]
end

#write(locale, value) ⇒ Object



14
15
16
17
# File 'lib/acts_as_multilingual/attribute_proxy.rb', line 14

def write(locale, value)
  owner[column][locale] = value
  owner[column].delete(locale) unless value
end