Class: Locomotive::Mounter::Models::Translation

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/models/translation.rb

Instance Attribute Summary

Attributes inherited from Base

#_id, #created_at, #mounting_point, #updated_at

Instance Method Summary collapse

Methods inherited from Base

#initialize, #persisted?

Methods included from Fields

#[], #attributes, #attributes_with_translations, #initialize, #localized_field?, #to_hash, #to_yaml, #translated_in, #translated_in?, #write_attributes

Constructor Details

This class inherits a constructor from Locomotive::Mounter::Models::Base

Instance Method Details

#get(locale) ⇒ Object

methods ##



13
14
15
# File 'lib/locomotive/mounter/models/translation.rb', line 13

def get(locale)
  self.values[locale.to_s]
end

#keyObject

fields ##



8
# File 'lib/locomotive/mounter/models/translation.rb', line 8

field :key

#to_paramsObject



17
18
19
# File 'lib/locomotive/mounter/models/translation.rb', line 17

def to_params
  { key: self.key, values: self.values }
end

#to_sObject



21
22
23
# File 'lib/locomotive/mounter/models/translation.rb', line 21

def to_s
  "Translation #{self.key} (#{self.values.keys.join(', ')})"
end