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

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

Instance Method Summary collapse

Constructor Details

#initialize(blk, transpose) ⇒ BlockTraverser

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



91
92
93
94
# File 'lib/goat/dom.rb', line 91

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

Instance Method Details

#component(c, &blk) ⇒ Object



112
113
114
115
116
117
118
# File 'lib/goat/dom.rb', line 112

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

#node(node, &blk) ⇒ Object



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

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

#string(str, &blk) ⇒ Object



104
105
106
107
108
109
110
# File 'lib/goat/dom.rb', line 104

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