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.



120
121
122
# File 'lib/src/extractor.rb', line 120

def initialize(node)
  @node = node
end

Instance Method Details

#raw_valueObject



124
125
126
127
128
129
130
131
132
# File 'lib/src/extractor.rb', line 124

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