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.
82 83 84 85 86 87 88 89 |
# File 'lib/cl/errors.rb', line 82 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.
80 81 82 |
# File 'lib/cl/errors.rb', line 80 def opts @opts end |
Instance Method Details
#suggestions ⇒ Object
91 92 93 |
# File 'lib/cl/errors.rb', line 91 def suggestions opts.map { |_, value, known| suggest(known, value) }.flatten end |