Class: Choosy::DSL::SuperCommandBuilder

Inherits:
BaseCommandBuilder show all
Defined in:
lib/choosy/dsl/super_command_builder.rb

Constant Summary collapse

HELP =
:help
SUPER =
:__SUPER_COMMAND__

Instance Attribute Summary

Attributes inherited from BaseCommandBuilder

#entity

Instance Method Summary collapse

Methods inherited from BaseCommandBuilder

#boolean, #boolean_, #enum, #enum_, #heading, #help, #initialize, #no_color, #option, #para, #printer, #summary, #version

Methods included from BaseBuilder

#evaluate!, #method_missing

Constructor Details

This class inherits a constructor from Choosy::DSL::BaseCommandBuilder

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Choosy::DSL::BaseBuilder

Instance Method Details

#command(cmd, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/choosy/dsl/super_command_builder.rb', line 6

def command(cmd, &block)
  subcommand = if cmd == :help
                 help_command
               elsif cmd.is_a?(Choosy::Command)
                 cmd.parent = entity
                 cmd
               else
                 Choosy::Command.new(cmd, entity)
               end

  evaluate_command_builder!(subcommand.builder, &block)
end

#default(cmd) ⇒ Object



27
28
29
# File 'lib/choosy/dsl/super_command_builder.rb', line 27

def default(cmd)
  @entity.default_command = cmd
end

#metaname(meta) ⇒ Object



23
24
25
# File 'lib/choosy/dsl/super_command_builder.rb', line 23

def metaname(meta)
  @entity.metaname = meta
end

#parsimoniousObject



19
20
21
# File 'lib/choosy/dsl/super_command_builder.rb', line 19

def parsimonious
  @entity.parsimonious = true
end