Class: Exemplar::Runner
- Inherits:
-
Object
- Object
- Exemplar::Runner
- Defined in:
- lib/exemplar/runner.rb
Instance Attribute Summary collapse
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(examples, options = nil) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
- #run?(example) ⇒ Boolean
Constructor Details
#initialize(examples, options = nil) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 |
# File 'lib/exemplar/runner.rb', line 7 def initialize(examples, = nil) @examples = examples @match_regex = && [:match] end |
Instance Attribute Details
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
5 6 7 |
# File 'lib/exemplar/runner.rb', line 5 def examples @examples end |
Class Method Details
.parse_options!(argv) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/exemplar/runner.rb', line 20 def self.(argv) = {} OptionParser.new do |opt| opt. = "Exemplar automatic example runner.\n" opt. << "Usage: #{$0} [options]" opt.on opt.on("-e", "--example [REGEX]", "Run examples matching the regex.") do |regex| [:match] = Regexp.new(regex) end opt.on_tail end.parse!(argv) rescue OptionParser::ParseError => e puts "%s. Run `#{$0} --help` for help." % e exit false end |