Class: Cl::UnknownValues
- Inherits:
-
OptionError
- Object
- Cl::UnknownValues
- Includes:
- Suggest
- Defined in:
- lib/cl/errors.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(opts) ⇒ UnknownValues
constructor
A new instance of UnknownValues.
- #suggestions ⇒ Object
Methods included from Suggest
Constructor Details
#initialize(opts) ⇒ UnknownValues
Returns a new instance of UnknownValues.
106 107 108 109 110 111 112 113 |
# File 'lib/cl/errors.rb', line 106 def initialize(opts) @opts = opts opts = opts.map do |(opt, values, known)| pairs = values.map { |value| [opt, value].join('=') }.join(' ') "#{pairs} (known values: #{known.join(', ')})" end super(:unknown_values, opts.join(', ')) end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
104 105 106 |
# File 'lib/cl/errors.rb', line 104 def opts @opts end |
Instance Method Details
#suggestions ⇒ Object
115 116 117 |
# File 'lib/cl/errors.rb', line 115 def suggestions opts.map { |_, value, known| suggest(known, value) }.flatten end |