Class: Locraft::Localization
- Inherits:
-
Object
- Object
- Locraft::Localization
- Defined in:
- lib/locraft/model/localization.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#key ⇒ Object
Returns the value of attribute key.
-
#language ⇒ Object
Returns the value of attribute language.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
4 5 6 |
# File 'lib/locraft/model/localization.rb', line 4 def comment @comment end |
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/locraft/model/localization.rb', line 5 def key @key end |
#language ⇒ Object
Returns the value of attribute language.
3 4 5 |
# File 'lib/locraft/model/localization.rb', line 3 def language @language end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/locraft/model/localization.rb', line 6 def value @value end |
Class Method Details
.load_with_csv_row(row, config, lang) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/locraft/model/localization.rb', line 8 def self.load_with_csv_row(row, config, lang) localization = Localization.new localization.language = lang localization.comment = row[config.gdoc_comments_column]&.strip localization.value = (row[lang] || row[config.default_lang])&.strip key = (row[config.gdoc_keys_column] || row[config.default_lang])&.strip localization.key = config.keys_map[key] || key localization end |
Instance Method Details
#strict_value ⇒ Object
22 23 24 |
# File 'lib/locraft/model/localization.rb', line 22 def strict_value value.gsub("\n", "\\n") end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/locraft/model/localization.rb', line 18 def valid? !(key.nil? or value.nil?) end |