Module: Plumb::VisitorHandlers::ClassMethods
- Defined in:
- lib/plumb/visitor_handlers.rb
Instance Method Summary collapse
Instance Method Details
#on(node_name, &block) ⇒ Object
10 11 12 13 |
# File 'lib/plumb/visitor_handlers.rb', line 10 def on(node_name, &block) name = node_name.is_a?(Symbol) ? node_name : :"#{node_name}_class" define_method("visit_#{name}", &block) end |
#visit(node, props = BLANK_HASH) ⇒ Object
15 16 17 |
# File 'lib/plumb/visitor_handlers.rb', line 15 def visit(node, props = BLANK_HASH) new.visit(node, props) end |