Class: YourKarma::CLI
- Inherits:
-
Object
- Object
- YourKarma::CLI
- Defined in:
- lib/yourkarma/cli.rb
Defined Under Namespace
Classes: ArgumentParser, Reporter
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CLI
Returns a new instance of CLI.
19 20 21 |
# File 'lib/yourkarma/cli.rb', line 19 def initialize( = {}) self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/yourkarma/cli.rb', line 8 def end |
Class Method Details
.run(io, arguments) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/yourkarma/cli.rb', line 10 def self.run(io, arguments) = { io: io } .merge! ArgumentParser.new.parse(arguments) self.new().run rescue ArgumentParser::InvalidOption => e [:io].puts e 1 end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/yourkarma/cli.rb', line 23 def run client = Client.new() benchmarker = Benchmarker.new() reporter = Reporter.new() reporter.report_header iterations = [:iterations] || Float::INFINITY code = 1 (1..iterations).each do begin code = run_once(client, benchmarker, reporter) rescue Interrupt break end end reporter.report_quit(code) end |