Class: Interscript::DSL::Group
- Inherits:
-
Object
- Object
- Interscript::DSL::Group
- Includes:
- Items
- Defined in:
- lib/interscript/dsl/group.rb
Defined Under Namespace
Classes: Parallel
Instance Attribute Summary collapse
-
#node ⇒ Object
Returns the value of attribute node.
Instance Method Summary collapse
- #downcase ⇒ Object
-
#initialize(&block) ⇒ Group
constructor
A new instance of Group.
- #parallel(**kwargs, &block) ⇒ Object
- #run(stage, **kwargs) ⇒ Object
- #sub(from, to, **kwargs, &block) ⇒ Object
- #upcase ⇒ Object
Methods included from Items
#any, #capture, #map, #maybe, #maybe_some, #method_missing, #ref, #some, #stage
Methods included from SymbolMM
Constructor Details
#initialize(&block) ⇒ Group
Returns a new instance of Group.
6 7 8 9 |
# File 'lib/interscript/dsl/group.rb', line 6 def initialize(&block) @node = Interscript::Node::Group.new self.instance_exec(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Interscript::DSL::Items
Instance Attribute Details
#node ⇒ Object
Returns the value of attribute node.
4 5 6 |
# File 'lib/interscript/dsl/group.rb', line 4 def node @node end |
Instance Method Details
#downcase ⇒ Object
28 |
# File 'lib/interscript/dsl/group.rb', line 28 def downcase; :downcase; end |
#parallel(**kwargs, &block) ⇒ Object
39 40 41 42 43 |
# File 'lib/interscript/dsl/group.rb', line 39 def parallel(**kwargs, &block) puts "parallel(#{chars.inspect}) from #{self.inspect}" if $DEBUG group = Interscript::DSL::Group::Parallel.new(**kwargs, &block) @node.children << group.node end |
#run(stage, **kwargs) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/interscript/dsl/group.rb', line 11 def run(stage, **kwargs) if stage.class != Interscript::Node::Item::Stage raise TypeError, "I::Node::Item::Stage expected, got #{stage.class}" end @node.children << Interscript::Node::Rule::Run.new(stage, **kwargs) end |
#sub(from, to, **kwargs, &block) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/interscript/dsl/group.rb', line 18 def sub(from, to, **kwargs, &block) puts "sub(#{from.inspect},#{to}, kwargs = #{ kwargs.inspect }) from #{self.inspect}" if $DEBUG rule = Interscript::Node::Rule::Sub.new(from, to, **kwargs) @node.children << rule end |
#upcase ⇒ Object
27 |
# File 'lib/interscript/dsl/group.rb', line 27 def upcase; :upcase; end |