Module: Plumb::VisitorHandlers::ClassMethods
- Defined in:
- lib/plumb/visitor_handlers.rb
Instance Method Summary collapse
Instance Method Details
#on(node_name, &block) ⇒ Object
21 22 23 24 |
# File 'lib/plumb/visitor_handlers.rb', line 21 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
26 27 28 |
# File 'lib/plumb/visitor_handlers.rb', line 26 def visit(node, props = BLANK_HASH) new.visit(node, props) end |