Class: Docuvator::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/docuvator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



6
7
8
9
10
11
12
13
# File 'lib/docuvator.rb', line 6

def initialize
  @options = OpenStruct.new(
    verbose: false,
    debug: false,
  )
  parse_options
  determine_log_level
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/docuvator.rb', line 5

def options
  @options
end

Instance Method Details

#parse_optionsObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/docuvator.rb', line 20

def parse_options
  OptionParser.new do |opt|
    opt.version = VERSION
    opt.on "-v", "--verbose", "Verbose output (shows INFO level log statements)" do
      options.verbose = true
    end
    opt.on "-d", "--debug", "Debug output (shows DEBUG level log statements)" do
      options.debug = true
    end
  end.parse!
end

#process(file) ⇒ Object



15
16
17
18
# File 'lib/docuvator.rb', line 15

def process(file)
  Log.info "Processing #{file}"
  Splitter.new(file).split
end