Module: Translator::Translates::ClassMethods

Defined in:
lib/translator/translates.rb

Instance Method Summary collapse

Instance Method Details

#prefixed_attributesObject



59
60
61
# File 'lib/translator/translates.rb', line 59

def prefixed_attributes
  @prefixed_attributes ||= translated_attributes.map{ |a| Translator.prefixed(a) }.flatten
end

#translated_attributesObject



55
56
57
# File 'lib/translator/translates.rb', line 55

def translated_attributes
  @translated_attributes ||= []
end

#translates(*args) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/translator/translates.rb', line 43

def translates *args
  self.translated_attributes = args
  self.translated_attributes.each do |name|
    translated_attr_accessor name
    translations_attr_accessor name
  end
end

#translates?(name) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/translator/translates.rb', line 51

def translates? name
  self.translated_attributes.include? name
end