Class: Yard2steep::CLI::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/yard2steep/cli/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOption

Returns a new instance of Option.



9
10
11
12
13
14
# File 'lib/yard2steep/cli/option.rb', line 9

def initialize
  @src       = '.' # NOTE: Current directory is used as default
  @dst       = 'sig'
  @debug     = false
  @debug_ast = false
end

Instance Attribute Details

#debugObject (readonly)

Returns the value of attribute debug.



7
8
9
# File 'lib/yard2steep/cli/option.rb', line 7

def debug
  @debug
end

#debug_astObject (readonly)

Returns the value of attribute debug_ast.



7
8
9
# File 'lib/yard2steep/cli/option.rb', line 7

def debug_ast
  @debug_ast
end

#dstObject (readonly)

Returns the value of attribute dst.



7
8
9
# File 'lib/yard2steep/cli/option.rb', line 7

def dst
  @dst
end

#srcObject (readonly)

Returns the value of attribute src.



7
8
9
# File 'lib/yard2steep/cli/option.rb', line 7

def src
  @src
end

Instance Method Details

#parse!(argv) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/yard2steep/cli/option.rb', line 16

def parse!(argv)
  opt = OptionParser.new
  opt.on('--debug') { |v| @debug = true }
  opt.on('--debug-ast') { |v| @debug_ast = true }
  opt.parse!(argv)

  @src = argv[0] if argv[0]
  @dst = argv[1] if argv[1]
end