Class: ActsAsMultilingual::AttributeProxy
- Inherits:
-
Object
- Object
- ActsAsMultilingual::AttributeProxy
- Defined in:
- lib/acts_as_multilingual/attribute_proxy.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
-
#initialize(owner, column) ⇒ AttributeProxy
constructor
A new instance of AttributeProxy.
- #read(locale) ⇒ Object
- #write(locale, value) ⇒ Object
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
#column ⇒ Object (readonly)
Returns the value of attribute column.
3 4 5 |
# File 'lib/acts_as_multilingual/attribute_proxy.rb', line 3 def column @column end |
#owner ⇒ Object (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 |