Class: Prick::Build::BuildBatch
- Inherits:
-
Object
- Object
- Prick::Build::BuildBatch
- Includes:
- Timer
- Defined in:
- lib/prick/builder/batch.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
- #dump ⇒ Object
- #execute(**opts, &block) ⇒ Object
-
#initialize(builder) ⇒ BuildBatch
constructor
A new instance of BuildBatch.
- #kind ⇒ Object
Methods included from Timer
file, file=, new, off!, off?, on!, on?, scale, scale=, #time, time, unit, unit=
Constructor Details
#initialize(builder) ⇒ BuildBatch
Returns a new instance of BuildBatch.
12 13 14 15 |
# File 'lib/prick/builder/batch.rb', line 12 def initialize(builder) @builder = builder @nodes = [] end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
6 7 8 |
# File 'lib/prick/builder/batch.rb', line 6 def builder @builder end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
10 11 12 |
# File 'lib/prick/builder/batch.rb', line 10 def nodes @nodes end |
Instance Method Details
#dump ⇒ Object
28 29 30 31 |
# File 'lib/prick/builder/batch.rb', line 28 def dump puts kind.upcase indent { nodes.each(&:dump) } end |
#execute(**opts, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/prick/builder/batch.rb', line 17 def execute(**opts, &block) name = self.class.to_s.sub(/.*::/, "").split(/(?=[A-Z])/).map(&:downcase).join(" ") node_paths = nodes.map(&:relpath) time "Execute #{name} (nodes: #{nodes.size})" do yield(**opts) end if Timer.on? ::Timer.file.indent { |f| f.puts node_paths } end end |
#kind ⇒ Object
9 |
# File 'lib/prick/builder/batch.rb', line 9 def kind() @nodes.first&.kind end |