Class: Globalize::ActiveRecord::Attributes

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) [](locale)



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

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

- (Boolean) contains?(locale, attr_name)

Returns:

  • (Boolean)


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

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

- (Object) read(locale, attr_name)



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

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

- (Object) write(locale, attr_name, value)



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

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