Class: Lokale::LString
- Inherits:
-
Object
- Object
- Lokale::LString
- Defined in:
- lib/lokale.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#note ⇒ Object
Returns the value of attribute note.
-
#str ⇒ Object
Returns the value of attribute str.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key, str, note, target) ⇒ LString
constructor
A new instance of LString.
Constructor Details
#initialize(key, str, note, target) ⇒ LString
Returns a new instance of LString.
31 32 33 |
# File 'lib/lokale.rb', line 31 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.
29 30 31 |
# File 'lib/lokale.rb', line 29 def key @key end |
#note ⇒ Object
Returns the value of attribute note.
29 30 31 |
# File 'lib/lokale.rb', line 29 def note @note end |
#str ⇒ Object
Returns the value of attribute str.
29 30 31 |
# File 'lib/lokale.rb', line 29 def str @str end |
#target ⇒ Object
Returns the value of attribute target.
29 30 31 |
# File 'lib/lokale.rb', line 29 def target @target end |
Class Method Details
.strings_from_file(file_path, lang) ⇒ Object
35 36 37 38 |
# File 'lib/lokale.rb', line 35 def self.strings_from_file(file_path, lang) regex = /(?:\/* (.+) *\/.*\n)?"(.+)" *= *"(.+)";/ File.read(file_path).scan(regex).map { |m| LString.new(m[1], m[2], m[0], lang) } end |