Class: HammerCLI::Options::Normalizers::EnumList
- Inherits:
-
AbstractNormalizer
- Object
- AbstractNormalizer
- HammerCLI::Options::Normalizers::EnumList
- Defined in:
- lib/hammer_cli/options/normalizers.rb
Instance Method Summary collapse
- #complete(value) ⇒ Object
- #description ⇒ Object
- #format(value) ⇒ Object
-
#initialize(allowed_values) ⇒ EnumList
constructor
A new instance of EnumList.
Constructor Details
#initialize(allowed_values) ⇒ EnumList
Returns a new instance of EnumList.
284 285 286 |
# File 'lib/hammer_cli/options/normalizers.rb', line 284 def initialize(allowed_values) @allowed_values = allowed_values end |
Instance Method Details
#complete(value) ⇒ Object
296 297 298 |
# File 'lib/hammer_cli/options/normalizers.rb', line 296 def complete(value) Completer::finalize_completions(@allowed_values) end |
#description ⇒ Object
288 289 290 |
# File 'lib/hammer_cli/options/normalizers.rb', line 288 def description _("Any combination (comma separated list) of '%s'") % quoted_values end |
#format(value) ⇒ Object
292 293 294 |
# File 'lib/hammer_cli/options/normalizers.rb', line 292 def format(value) value.is_a?(String) ? parse(value) : [] end |