Class: Command::ArrayArgument

Inherits:
Argument
  • Object
show all
Defined in:
lib/command-set/arguments.rb

Overview

Created with an array of options to choose from

Instance Attribute Summary

Attributes inherited from Argument

#name

Instance Method Summary collapse

Methods inherited from Argument

#basis, #check_present, #consume, #consume_hash, #initialize, #match_terms, #names, #omittable?, #parse, register, #required?, #subject_requirements

Constructor Details

This class inherits a constructor from Command::Argument

Instance Method Details

#complete(terms, prefix, subject) ⇒ Object



349
350
351
# File 'lib/command-set/arguments.rb', line 349

def complete(terms, prefix, subject)
  return basis(subject).grep(%r{^#{prefix}.*})
end

#validate(term, subject) ⇒ Object



353
354
355
# File 'lib/command-set/arguments.rb', line 353

def validate(term, subject)
  return basis(subject).include?(term)
end