Class: Goat::DOMTools::Traverser::BlockTraverser

Inherits:
Object
  • Object
show all
Defined in:
lib/goat/html.rb

Instance Method Summary collapse

Constructor Details

#initialize(blk, transpose) ⇒ BlockTraverser

would be infinitely nicer if you could just yield from a block



76
77
78
79
# File 'lib/goat/html.rb', line 76

def initialize(blk, transpose)
  @blk = blk
  @transpose = transpose
end

Instance Method Details

#component(c, &blk) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/goat/html.rb', line 97

def component(c, &blk)
  if @transpose
    @blk.call(c, blk)
  else
    @blk.call(c)
  end
end

#node(node, &blk) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/goat/html.rb', line 81

def node(node, &blk)
  if @transpose
    @blk.call(node, blk)
  else
    @blk.call(node)
  end
end

#string(str, &blk) ⇒ Object



89
90
91
92
93
94
95
# File 'lib/goat/html.rb', line 89

def string(str, &blk)
  if @transpose
    @blk.call(str, blk)
  else
    @blk.call(str)
  end
end