Class: Sablon::HTMLConverter::GrepVisitor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ GrepVisitor

Returns a new instance of GrepVisitor.



14
15
16
17
# File 'lib/sablon/html/visitor.rb', line 14

def initialize(pattern)
  @pattern = pattern
  @result = []
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



13
14
15
# File 'lib/sablon/html/visitor.rb', line 13

def result
  @result
end

Instance Method Details

#visit(node) ⇒ Object



19
20
21
22
23
# File 'lib/sablon/html/visitor.rb', line 19

def visit(node)
  if @pattern === node
    @result << node
  end
end