Class: Bracken::Configuration::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/bracken/configuration/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

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_fileObject (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_linesObject (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.options 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