Class: NodeValue

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

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ NodeValue

Returns a new instance of NodeValue.



111
112
113
# File 'lib/src/extractor.rb', line 111

def initialize(node)
  @node = node
end

Instance Method Details

#raw_valueObject



115
116
117
118
119
120
121
122
123
# File 'lib/src/extractor.rb', line 115

def raw_value
  return "" unless node

  node_size = node.try(:size).to_i
  return node.map(&:text) if node_size > 1
  return node.first if node_size == 1 && contains_children?

  node.text
end