Class: PerfMonger::Command::BaseCommand
- Inherits:
-
Object
- Object
- PerfMonger::Command::BaseCommand
- Defined in:
- lib/perfmonger/command/base_command.rb
Direct Known Subclasses
FingerprintCommand, InitShellCommand, LiveCommand, PlayCommand, PlotCommand, RecordCommand, ServerCommand, StatCommand, SummaryCommand
Class Attribute Summary collapse
-
.aliases ⇒ Object
Returns the value of attribute aliases.
-
.command_name ⇒ Object
Returns the value of attribute command_name.
-
.description ⇒ Object
Returns the value of attribute description.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ BaseCommand
constructor
A new instance of BaseCommand.
Constructor Details
#initialize ⇒ BaseCommand
Returns a new instance of BaseCommand.
28 29 30 31 32 33 34 35 |
# File 'lib/perfmonger/command/base_command.rb', line 28 def initialize @parser = OptionParser.new @parser. = "Usage: \#{File.basename($0)} \#{self.class.command_name} [options]\n\nOptions:\n" end |
Class Attribute Details
.aliases ⇒ Object
Returns the value of attribute aliases.
9 10 11 |
# File 'lib/perfmonger/command/base_command.rb', line 9 def aliases @aliases end |
.command_name ⇒ Object
Returns the value of attribute command_name.
7 8 9 |
# File 'lib/perfmonger/command/base_command.rb', line 7 def command_name @command_name end |
.description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/perfmonger/command/base_command.rb', line 8 def description @description end |
Class Method Details
.register_alias(alias_name) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/perfmonger/command/base_command.rb', line 17 def register_alias(alias_name) if self.command_name RuntimeError.new("#{self} does not have registered command name.") end self.aliases ||= [] self.aliases.push(alias_name) PerfMonger::CLI::Runner.register_alias(alias_name, self.command_name) end |
.register_command(command_name, description = "") ⇒ Object
11 12 13 14 15 |
# File 'lib/perfmonger/command/base_command.rb', line 11 def register_command(command_name, description = "") PerfMonger::CLI::Runner.register_command(command_name, self) self.command_name = command_name self.description = description end |