Class: Escort::Formatter::Commands
- Inherits:
-
Object
- Object
- Escort::Formatter::Commands
- Includes:
- Enumerable
- Defined in:
- lib/escort/formatter/commands.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#setup ⇒ Object
readonly
Returns the value of attribute setup.
Class Method Summary collapse
Instance Method Summary collapse
- #count ⇒ Object (also: #size)
- #each(&block) ⇒ Object
-
#initialize(setup, context) ⇒ Commands
constructor
A new instance of Commands.
Constructor Details
#initialize(setup, context) ⇒ Commands
Returns a new instance of Commands.
18 19 20 21 |
# File 'lib/escort/formatter/commands.rb', line 18 def initialize(setup, context) @setup = setup @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
16 17 18 |
# File 'lib/escort/formatter/commands.rb', line 16 def context @context end |
#setup ⇒ Object (readonly)
Returns the value of attribute setup.
16 17 18 |
# File 'lib/escort/formatter/commands.rb', line 16 def setup @setup end |
Class Method Details
.command_for(setup, context) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/escort/formatter/commands.rb', line 7 def command_for(setup, context) if context.empty? GlobalCommand.new(setup) else Command.new(context.last, setup, context) end end |
Instance Method Details
#count ⇒ Object Also known as: size
30 31 32 |
# File 'lib/escort/formatter/commands.rb', line 30 def count setup.canonical_command_names_for(context).size end |