Exception: Cl::UnknownOption

Inherits:
Error
  • Object
show all
Defined in:
lib/cl/errors.rb

Constant Summary collapse

VALUE =
/=[^ ]*/

Constants inherited from Error

Error::MSGS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, str) ⇒ UnknownOption

Returns a new instance of UnknownOption.



48
49
50
51
52
# File 'lib/cl/errors.rb', line 48

def initialize(cmd, str)
  @cmd = cmd
  @opt = str.sub('invalid option: ', '').sub(VALUE, '')
  super(:unknown_option, opt)
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



44
45
46
# File 'lib/cl/errors.rb', line 44

def cmd
  @cmd
end

#optObject (readonly)

Returns the value of attribute opt.



44
45
46
# File 'lib/cl/errors.rb', line 44

def opt
  @opt
end

Instance Method Details

#suggestionsObject



54
55
56
# File 'lib/cl/errors.rb', line 54

def suggestions
  cmd.suggestions(opt)
end