Module: OptimusPrime::ClassMethods

Defined in:
lib/optimus_prime.rb

Instance Method Summary collapse

Instance Method Details

#__optor__Object



36
37
38
# File 'lib/optimus_prime.rb', line 36

def __optor__
  @__optor__ ||= Optor.new(self, ARGV.dup)
end

#command(name, &block) ⇒ Object



48
49
50
# File 'lib/optimus_prime.rb', line 48

def command(name, &block)
  __optor__.command(name, block)
end

#commandsObject



52
53
54
# File 'lib/optimus_prime.rb', line 52

def commands
  __optor__.commands.keys
end

#flag(*flags) ⇒ Object



56
57
58
# File 'lib/optimus_prime.rb', line 56

def flag(*flags)
  flags.each { |name| __optor__.flag(name) }
end

#help(name) ⇒ Object



44
45
46
# File 'lib/optimus_prime.rb', line 44

def help(name)
  __optor__.help(name)
end

#init(instance) ⇒ Object



40
41
42
# File 'lib/optimus_prime.rb', line 40

def init(instance)
  __optor__.init(instance)
end

#option(*names) ⇒ Object



60
61
62
63
# File 'lib/optimus_prime.rb', line 60

def option(*names)
  options = names.last.is_a?(Hash) ? names.pop : {}
  names.each { |name| __optor__.option(name, options) }
end