Class: LocoStrings::LocoString
- Inherits:
-
Struct
- Object
- Struct
- LocoStrings::LocoString
- 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.
-
#state ⇒ Object
Returns the value of attribute state.
-
#translatable ⇒ Object
Returns the value of attribute translatable.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value, comment = nil, state = nil, translatable = nil) ⇒ LocoString
constructor
A new instance of LocoString.
- #to_s ⇒ Object
- #update(value, comment = nil, state = nil, translatable = nil) ⇒ Object
Constructor Details
#initialize(key, value, comment = nil, state = nil, translatable = nil) ⇒ LocoString
Returns a new instance of LocoString.
13 14 15 16 |
# File 'lib/loco_strings.rb', line 13 def initialize(key, value, comment = nil, state = nil, translatable = nil) translatable = true if translatable.nil? super(key, value, comment, state, translatable) end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment
12 13 14 |
# File 'lib/loco_strings.rb', line 12 def comment @comment end |
#key ⇒ Object
Returns the value of attribute key
12 13 14 |
# File 'lib/loco_strings.rb', line 12 def key @key end |
#state ⇒ Object
Returns the value of attribute state
12 13 14 |
# File 'lib/loco_strings.rb', line 12 def state @state end |
#translatable ⇒ Object
Returns the value of attribute translatable
12 13 14 |
# File 'lib/loco_strings.rb', line 12 def translatable @translatable end |
#value ⇒ Object
Returns the value of attribute value
12 13 14 |
# File 'lib/loco_strings.rb', line 12 def value @value end |
Instance Method Details
#to_s ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/loco_strings.rb', line 25 def to_s if translatable "Key: #{key}, Value: #{value}, Comment: #{comment || "None"}, " \ "State: #{state || "None"}" else "Key: #{key}, Value: #{value}, Comment: #{comment || "None"}, " \ "State: #{state || "None"}, Translatable: #{translatable}" end end |
#update(value, comment = nil, state = nil, translatable = nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/loco_strings.rb', line 18 def update(value, comment = nil, state = nil, translatable = nil) self.value = value self.comment = comment unless comment.nil? self.state = state self.translatable = translatable unless translatable.nil? end |