Class: Nokogiri::XML::NodeSet

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

Instance Method Summary collapse

Instance Method Details

#hchildrenObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/hmisc/hhtmlnode.rb', line 3

def hchildren

  result = []
  self.children.each do |node|
    result << node if(node.name != "text")
  end 

  return result

end

#to_a_of_hObject

array of hash



15
16
17
18
19
20
21
22
23
# File 'lib/hmisc/hhtmlnode.rb', line 15

def to_a_of_h # array of hash

  return self.map { |node| node.to_h.symbolize_keys }
  # The follow instruction is replaced by that above
  items = []
  self.each { |node| items << node.to_h.symbolize_keys }
  return items

end