Class: Lokale::LString

Inherits:
Object
  • Object
show all
Defined in:
lib/lokale.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#keyObject

Returns the value of attribute key.



29
30
31
# File 'lib/lokale.rb', line 29

def key
  @key
end

#noteObject

Returns the value of attribute note.



29
30
31
# File 'lib/lokale.rb', line 29

def note
  @note
end

#strObject

Returns the value of attribute str.



29
30
31
# File 'lib/lokale.rb', line 29

def str
  @str
end

#targetObject

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