Class: Globalize::ActiveRecord::Attributes

Inherits:
Hash
  • Object
show all
Defined in:
lib/globalize/active_record/attributes.rb

Instance Method Summary collapse

Instance Method Details

#[](locale) ⇒ Object



7
8
9
10
11
# File 'lib/globalize/active_record/attributes.rb', line 7

def [](locale)
  locale = locale.to_sym
  self[locale] = {} unless has_key?(locale)
  self.fetch(locale)
end

#contains?(locale, attr_name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/globalize/active_record/attributes.rb', line 13

def contains?(locale, attr_name)
  self[locale].has_key?(attr_name)
end

#read(locale, attr_name) ⇒ Object



17
18
19
# File 'lib/globalize/active_record/attributes.rb', line 17

def read(locale, attr_name)
  self[locale][attr_name]
end

#write(locale, attr_name, value) ⇒ Object



21
22
23
# File 'lib/globalize/active_record/attributes.rb', line 21

def write(locale, attr_name, value)
  self[locale][attr_name] = value
end