Class: OoxmlParser::TextField

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb', line 3

def id
  @id
end

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb', line 3

def text
  @text
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb', line 3

def type
  @type
end

Class Method Details

.parse(text_field_node) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb', line 5

def self.parse(text_field_node)
  text_field = TextField.new
  text_field.id = text_field_node.attribute('id').value
  text_field.type = text_field_node.attribute('type').value
  text_field_node.xpath('*').each do |text_field_node_child|
    case text_field_node_child.name
    when 't'
      text_field.text = text_field_node_child.text
    end
  end
  text_field
end