Class: I18nYamlEditor::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_yaml_editor/translation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Translation

Returns a new instance of Translation.



7
8
9
# File 'lib/i18n_yaml_editor/translation.rb', line 7

def initialize attributes={}
  @name, @file, @text = attributes.values_at(:name, :file, :text)
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



5
6
7
# File 'lib/i18n_yaml_editor/translation.rb', line 5

def file
  @file
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/i18n_yaml_editor/translation.rb', line 5

def name
  @name
end

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/i18n_yaml_editor/translation.rb', line 5

def text
  @text
end

Instance Method Details

#keyObject



11
12
13
# File 'lib/i18n_yaml_editor/translation.rb', line 11

def key
  @key ||= self.name.split(".")[1..-1].join(".")
end

#localeObject



15
16
17
# File 'lib/i18n_yaml_editor/translation.rb', line 15

def locale
  @locale ||= self.name.split(".").first
end