Class: Bracken::Configuration::Options
- Inherits:
-
Object
- Object
- Bracken::Configuration::Options
- Defined in:
- lib/bracken/configuration/options.rb
Instance Attribute Summary collapse
-
#configuration_file ⇒ Object
readonly
Returns the value of attribute configuration_file.
-
#number_of_lines ⇒ Object
readonly
Returns the value of attribute number_of_lines.
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #parse(arguments) ⇒ Object
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
10 11 12 13 |
# File 'lib/bracken/configuration/options.rb', line 10 def initialize @configuration_file = '/etc/bracken.rb' @number_of_lines = 1000 end |
Instance Attribute Details
#configuration_file ⇒ Object (readonly)
Returns the value of attribute configuration_file.
7 8 9 |
# File 'lib/bracken/configuration/options.rb', line 7 def configuration_file @configuration_file end |
#number_of_lines ⇒ Object (readonly)
Returns the value of attribute number_of_lines.
8 9 10 |
# File 'lib/bracken/configuration/options.rb', line 8 def number_of_lines @number_of_lines end |
Instance Method Details
#parse(arguments) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bracken/configuration/options.rb', line 15 def parse(arguments) arguments.extend(::OptionParser::Arguable) arguments. do |opts| opts.on('-c', '--config-file=PATH', 'Read configuration from PATH.', '[/etc/bracken.rb]') do |path| @configuration_file = path end opts.on('-n', '--lines=N', Integer, 'Tail the last N lines from each file.', '[1000]') do |number| @number_of_lines = number end end.parse! end |