Class: Lokale::LString
- Inherits:
-
Object
- Object
- Lokale::LString
- Defined in:
- lib/lokale/model.rb,
lib/lokale/agent.rb,
lib/lokale/model.rb
Overview
Hashable
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#note ⇒ Object
Returns the value of attribute note.
-
#source ⇒ Object
Returns the value of attribute source.
-
#str ⇒ Object
Returns the value of attribute str.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #fields ⇒ Object
- #for_export(lang) ⇒ Object
- #hash ⇒ Object
-
#initialize(key, str, note, target) ⇒ LString
constructor
A new instance of LString.
- #inspect ⇒ Object
- #pretty ⇒ Object
- #write_format ⇒ Object
Constructor Details
#initialize(key, str, note, target) ⇒ LString
Returns a new instance of LString.
20 21 22 |
# File 'lib/lokale/model.rb', line 20 def initialize(key, str, note, target) @key = key; @str = str; @note = note; @target = target end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
18 19 20 |
# File 'lib/lokale/model.rb', line 18 def key @key end |
#note ⇒ Object
Returns the value of attribute note.
18 19 20 |
# File 'lib/lokale/model.rb', line 18 def note @note end |
#source ⇒ Object
Returns the value of attribute source.
38 39 40 |
# File 'lib/lokale/agent.rb', line 38 def source @source end |
#str ⇒ Object
Returns the value of attribute str.
18 19 20 |
# File 'lib/lokale/model.rb', line 18 def str @str end |
#target ⇒ Object
Returns the value of attribute target.
18 19 20 |
# File 'lib/lokale/model.rb', line 18 def target @target end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
127 128 129 |
# File 'lib/lokale/model.rb', line 127 def ==(other) self.class === other && other.fields == fields end |
#fields ⇒ Object
123 124 125 |
# File 'lib/lokale/model.rb', line 123 def fields [@key, @str, @note, @target] end |
#for_export(lang) ⇒ Object
40 41 42 43 44 |
# File 'lib/lokale/agent.rb', line 40 def for_export(lang) str = LString.new(@key, nil, @note, lang) str.source = @str str end |
#hash ⇒ Object
133 134 135 |
# File 'lib/lokale/model.rb', line 133 def hash fields.hash end |
#inspect ⇒ Object
29 30 31 |
# File 'lib/lokale/model.rb', line 29 def inspect "<\#LS:#{@key}; s:#{@str}; n:#{@note}; t:#{@target}>" end |
#pretty ⇒ Object
34 35 36 |
# File 'lib/lokale/agent.rb', line 34 def pretty "\"#{key}\" = \"#{str}\";" end |
#write_format ⇒ Object
30 31 32 |
# File 'lib/lokale/agent.rb', line 30 def write_format "/* #{note} */\n\"#{key}\" = \"#{str}\";\n" end |