Class: EXEL::Job::Parser
- Inherits:
-
Object
- Object
- EXEL::Job::Parser
- Defined in:
- lib/exel/job.rb
Overview
Defines the EXEL DSL methods and is used to convert a block of Ruby code into an abstract syntax tree (AST)
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
Class Method Summary collapse
Instance Method Summary collapse
- #async(options = {}, &block) ⇒ Object
- #context ⇒ Object
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #listen(options) ⇒ Object
- #process(options, &block) ⇒ Object
- #run(options = {}, &block) ⇒ Object
- #split(options = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
51 52 53 |
# File 'lib/exel/job.rb', line 51 def initialize @ast = SequenceNode.new end |
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
49 50 51 |
# File 'lib/exel/job.rb', line 49 def ast @ast end |
Class Method Details
Instance Method Details
#async(options = {}, &block) ⇒ Object
70 71 72 |
# File 'lib/exel/job.rb', line 70 def async( = {}, &block) add_instruction_node(Processors::AsyncProcessor, parse(block), ) end |
#context ⇒ Object
87 88 89 |
# File 'lib/exel/job.rb', line 87 def context DeferredContextValue.new end |
#listen(options) ⇒ Object
82 83 84 85 |
# File 'lib/exel/job.rb', line 82 def listen() instruction = ListenInstruction.new(.fetch(:for), .fetch(:with)) @ast.add_child(InstructionNode.new(instruction)) end |
#process(options, &block) ⇒ Object
65 66 67 68 |
# File 'lib/exel/job.rb', line 65 def process(, &block) processor_class = .delete(:with) add_instruction_node(processor_class, parse(block), ) end |
#run(options = {}, &block) ⇒ Object
78 79 80 |
# File 'lib/exel/job.rb', line 78 def run( = {}, &block) add_instruction_node(Processors::RunProcessor, parse(block), ) end |
#split(options = {}, &block) ⇒ Object
74 75 76 |
# File 'lib/exel/job.rb', line 74 def split( = {}, &block) add_instruction_node(Processors::SplitProcessor, parse(block), ) end |