Class: Sablon::HTMLConverter::GrepVisitor
- Inherits:
-
Object
- Object
- Sablon::HTMLConverter::GrepVisitor
- Defined in:
- lib/sablon/html/visitor.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(pattern) ⇒ GrepVisitor
constructor
A new instance of GrepVisitor.
- #visit(node) ⇒ Object
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
#result ⇒ Object (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 |