Class: Lugg::Runner
- Inherits:
-
Object
- Object
- Lugg::Runner
- Defined in:
- lib/lugg/runner.rb
Overview
TODO:
extract conditions into individual objects.
The runner defines the command line interface for Lugg, using the other components and defining command line options and their implementations.
When creating a Runner object, you pass it your option flags (typically
ARGV). You can then apply its conditions to an IO object (typically
ARGF).
Instance Method Summary collapse
- #add_clause(&block) ⇒ Object
- #combine_next ⇒ Object
-
#initialize(flags = [], filter = Filter.new) ⇒ Runner
constructor
A new instance of Runner.
- #run(io) ⇒ Object
Constructor Details
Instance Method Details
#add_clause(&block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lugg/runner.rb', line 33 def add_clause(&block) if combine_clauses? prev_block = @last_block filter.use { |r| prev_block.call(r) && block.call(r) } reset else filter.use(&block) @last_block = block end end |
#combine_next ⇒ Object
44 45 46 |
# File 'lib/lugg/runner.rb', line 44 def combine_next @combine = true end |