Class: HammerCLI::Options::Normalizers::EnumList

Inherits:
AbstractNormalizer show all
Defined in:
lib/hammer_cli/options/normalizers.rb

Instance Method Summary collapse

Constructor Details

#initialize(allowed_values) ⇒ EnumList

Returns a new instance of EnumList.



275
276
277
# File 'lib/hammer_cli/options/normalizers.rb', line 275

def initialize(allowed_values)
  @allowed_values = allowed_values
end

Instance Method Details

#complete(value) ⇒ Object



287
288
289
# File 'lib/hammer_cli/options/normalizers.rb', line 287

def complete(value)
  Completer::finalize_completions(@allowed_values)
end

#descriptionObject



279
280
281
# File 'lib/hammer_cli/options/normalizers.rb', line 279

def description
  _("Any combination (comma separated list) of '%s'") % quoted_values
end

#format(value) ⇒ Object



283
284
285
# File 'lib/hammer_cli/options/normalizers.rb', line 283

def format(value)
  value.is_a?(String) ? parse(value) : []
end