Class: CTioga2::Commands::CommandGroup
- Inherits:
-
Object
- Object
- CTioga2::Commands::CommandGroup
- Defined in:
- lib/ctioga2/commands/groups.rb
Overview
A group of commands, organized along a same theme.
Instance Attribute Summary collapse
-
#blacklisted ⇒ Object
Whether the group is blacklisted or not, ie whether the group’s help text will be displayed at all.
-
#commands ⇒ Object
The commands belonging to the group.
-
#context ⇒ Object
The context of definition [file, line].
-
#description ⇒ Object
A (longer) description of the group.
-
#id ⇒ Object
A short, unique, codelike name for the group.
-
#name ⇒ Object
The name of the group.
-
#priority ⇒ Object
The priority of the group.
Instance Method Summary collapse
-
#initialize(id, name, desc = nil, priority = 0, blacklist = false, register = true) ⇒ CommandGroup
constructor
A new instance of CommandGroup.
Constructor Details
#initialize(id, name, desc = nil, priority = 0, blacklist = false, register = true) ⇒ CommandGroup
Returns a new instance of CommandGroup.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ctioga2/commands/groups.rb', line 50 def initialize(id, name, desc = nil, priority = 0, blacklist = false, register = true) @commands = [] @name = name @id = id @description = desc || name @priority = priority @blacklisted = blacklist if register Interpreter.register_group(self) end # The context in which the group was defined caller[1].gsub(/.*\/ctioga2\//, 'lib/ctioga2/') =~ /(.*):(\d+)/ @context = [$1, $2.to_i] end |
Instance Attribute Details
#blacklisted ⇒ Object
Whether the group is blacklisted or not, ie whether the group’s help text will be displayed at all.
45 46 47 |
# File 'lib/ctioga2/commands/groups.rb', line 45 def blacklisted @blacklisted end |
#commands ⇒ Object
The commands belonging to the group
27 28 29 |
# File 'lib/ctioga2/commands/groups.rb', line 27 def commands @commands end |
#context ⇒ Object
The context of definition [file, line]
48 49 50 |
# File 'lib/ctioga2/commands/groups.rb', line 48 def context @context end |
#description ⇒ Object
A (longer) description of the group
36 37 38 |
# File 'lib/ctioga2/commands/groups.rb', line 36 def description @description end |
#id ⇒ Object
A short, unique, codelike name for the group.
33 34 35 |
# File 'lib/ctioga2/commands/groups.rb', line 33 def id @id end |
#name ⇒ Object
The name of the group
30 31 32 |
# File 'lib/ctioga2/commands/groups.rb', line 30 def name @name end |
#priority ⇒ Object
The priority of the group. It influences the positioning of its command-line options in the –help display. Lower priorities come first.
41 42 43 |
# File 'lib/ctioga2/commands/groups.rb', line 41 def priority @priority end |