Class: ActsAsLocalizable::AR::LocalValues
- Inherits:
-
Object
- Object
- ActsAsLocalizable::AR::LocalValues
- Defined in:
- lib/acts_as_localizable.rb
Instance Method Summary collapse
-
#initialize(locale, default_values) ⇒ LocalValues
constructor
A new instance of LocalValues.
- #locale ⇒ Object
- #modified? ⇒ Boolean
- #modified_attributes ⇒ Object
Constructor Details
#initialize(locale, default_values) ⇒ LocalValues
Returns a new instance of LocalValues.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/acts_as_localizable.rb', line 17 def initialize(locale,default_values) self.instance_variable_set("@locale",locale) self.instance_variable_set("@modified",false) self.instance_variable_set("@modified_attributes",[]) default_values.each_pair do |key,value| self.instance_variable_set("@#{key}",value) self.class_eval("attr_reader :#{key}") self.class_eval("def #{key}=(value) @modified = true @modified_attributes << '#{key}' instance_variable_set('@#{key}',value) end") end end |
Instance Method Details
#locale ⇒ Object
40 41 42 |
# File 'lib/acts_as_localizable.rb', line 40 def locale return self.instance_variable_get("@locale") end |
#modified? ⇒ Boolean
34 35 36 |
# File 'lib/acts_as_localizable.rb', line 34 def modified? return self.instance_variable_get("@modified") end |
#modified_attributes ⇒ Object
37 38 39 |
# File 'lib/acts_as_localizable.rb', line 37 def modified_attributes return self.instance_variable_get("@modified_attributes") end |