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.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ctioga2/commands/groups.rb', line 48 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.
43 44 45 |
# File 'lib/ctioga2/commands/groups.rb', line 43 def blacklisted @blacklisted end |
#commands ⇒ Object
The commands belonging to the group
25 26 27 |
# File 'lib/ctioga2/commands/groups.rb', line 25 def commands @commands end |
#context ⇒ Object
The context of definition [file, line]
46 47 48 |
# File 'lib/ctioga2/commands/groups.rb', line 46 def context @context end |
#description ⇒ Object
A (longer) description of the group
34 35 36 |
# File 'lib/ctioga2/commands/groups.rb', line 34 def description @description end |
#id ⇒ Object
A short, unique, codelike name for the group.
31 32 33 |
# File 'lib/ctioga2/commands/groups.rb', line 31 def id @id end |
#name ⇒ Object
The name of the group
28 29 30 |
# File 'lib/ctioga2/commands/groups.rb', line 28 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.
39 40 41 |
# File 'lib/ctioga2/commands/groups.rb', line 39 def priority @priority end |