Class: Fmt::Pipeline
Overview
Note:
Pipelines are processed in sequence (left to right)
Represents a series of Macros
A Pipeline is comprised of:
-
macros: Array
Instance Attribute Summary collapse
-
#macros ⇒ Object
readonly
: Array.
Attributes inherited from Model
AST Processors collapse
-
#on_macro(node) ⇒ Object
Processes a macro AST node.
-
#on_pipeline(node) ⇒ Object
Processes a pipeline AST node.
Instance Method Summary collapse
-
#initialize(ast) ⇒ Pipeline
constructor
Constructor.
-
#to_h ⇒ Object
Hash representation of the model (required for pattern matching).
Methods inherited from Model
Methods included from Matchable
#deconstruct, #deconstruct_keys
Constructor Details
#initialize(ast) ⇒ Pipeline
Constructor
16 17 18 19 |
# File 'lib/fmt/models/pipeline.rb', line 16 def initialize(ast) @macros = [] super end |
Instance Attribute Details
#macros ⇒ Object (readonly)
: Array
21 22 23 |
# File 'lib/fmt/models/pipeline.rb', line 21 def macros @macros end |
Instance Method Details
#on_macro(node) ⇒ Object
Processes a macro AST node
43 44 45 |
# File 'lib/fmt/models/pipeline.rb', line 43 def on_macro(node) @macros << Macro.new(node) end |
#on_pipeline(node) ⇒ Object
Processes a pipeline AST node
36 37 38 |
# File 'lib/fmt/models/pipeline.rb', line 36 def on_pipeline(node) process_all node.children end |
#to_h ⇒ Object
Hash representation of the model (required for pattern matching)
25 26 27 |
# File 'lib/fmt/models/pipeline.rb', line 25 def to_h super.merge macros: macros.map(&:to_h) end |