Class: Muffins::Document

Inherits:
Object
  • Object
show all
Includes:
Virtus
Defined in:
lib/muffins/document.rb

Instance Method Summary collapse

Instance Method Details

#all(path) ⇒ Object



14
15
16
# File 'lib/muffins/document.rb', line 14

def all(path)
  xml.css(path)
end

#each(path, &block) ⇒ Object



24
25
26
# File 'lib/muffins/document.rb', line 24

def each(path, &block)
  all(path).each { |node| yield node }
end

#first(path) ⇒ Object



9
10
11
# File 'lib/muffins/document.rb', line 9

def first(path)
  xml.at_css(path)
end

#map(path, &block) ⇒ Object



19
20
21
# File 'lib/muffins/document.rb', line 19

def map(path, &block)
  all(path).map { |node| yield node }
end