Class: LocoStrings::LocoVariantions
- Inherits:
-
Struct
- Object
- Struct
- LocoStrings::LocoVariantions
- Defined in:
- lib/loco_strings.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#key ⇒ Object
Returns the value of attribute key.
-
#strings ⇒ Object
Returns the value of attribute strings.
Instance Method Summary collapse
- #append_string(string) ⇒ Object
-
#initialize(key, strings = nil, comment = nil) ⇒ LocoVariantions
constructor
A new instance of LocoVariantions.
- #to_s ⇒ Object
- #update_variant(key, value, comment = nil, state = nil) ⇒ Object
Constructor Details
#initialize(key, strings = nil, comment = nil) ⇒ LocoVariantions
Returns a new instance of LocoVariantions.
29 30 31 32 |
# File 'lib/loco_strings.rb', line 29 def initialize(key, strings = nil, comment = nil) super self.strings = strings || {} end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment
28 29 30 |
# File 'lib/loco_strings.rb', line 28 def comment @comment end |
#key ⇒ Object
Returns the value of attribute key
28 29 30 |
# File 'lib/loco_strings.rb', line 28 def key @key end |
#strings ⇒ Object
Returns the value of attribute strings
28 29 30 |
# File 'lib/loco_strings.rb', line 28 def strings @strings end |
Instance Method Details
#append_string(string) ⇒ Object
34 35 36 |
# File 'lib/loco_strings.rb', line 34 def append_string(string) strings[string.key] = string end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/loco_strings.rb', line 46 def to_s "Key: #{key}, Strings: #{strings}, Comment: #{comment || "None"}" end |
#update_variant(key, value, comment = nil, state = nil) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/loco_strings.rb', line 38 def update_variant(key, value, comment = nil, state = nil) if strings.key? key strings[key].update(value, comment, state) else strings[key] = LocoString.new(key, value, comment, state) end end |