Class: XLIFFer::XLIFF::String

Inherits:
Object
  • Object
show all
Defined in:
lib/xliffer/xliff/string.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trans_unit_xml) ⇒ String

Returns a new instance of String.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/xliffer/xliff/string.rb', line 5

def initialize(trans_unit_xml)
  unless XLIFF::xml_element?(trans_unit_xml) and trans_unit?(trans_unit_xml)
    raise ArgumentError, "can't create a String without a trans-unit subtree"
  end

  @xml = trans_unit_xml
  @id = @xml.attr('id')
  @source = get_source
  @target = get_target
  @note   = get_note
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/xliffer/xliff/string.rb', line 4

def id
  @id
end

#noteObject (readonly)

Returns the value of attribute note.



4
5
6
# File 'lib/xliffer/xliff/string.rb', line 4

def note
  @note
end

#sourceObject

Returns the value of attribute source.



4
5
6
# File 'lib/xliffer/xliff/string.rb', line 4

def source
  @source
end

#targetObject

Returns the value of attribute target.



4
5
6
# File 'lib/xliffer/xliff/string.rb', line 4

def target
  @target
end