Class: Loops::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/loops/command.rb

Overview

Represents a Loops command.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommand

Initializes a new Loops::Command instance.



12
13
# File 'lib/loops/command.rb', line 12

def initialize
end

Instance Attribute Details

#engineEngine (readonly)

Returns The instance of Engine to execute command in.

Returns:

  • (Engine)

    The instance of Engine to execute command in.



5
6
7
# File 'lib/loops/command.rb', line 5

def engine
  @engine
end

#optionsHash<String, Object> (readonly)

Returns The hash of (parsed) command-line options.

Returns:

  • (Hash<String, Object>)

    The hash of (parsed) command-line options.



9
10
11
# File 'lib/loops/command.rb', line 9

def options
  @options
end

Instance Method Details

#executeObject

A command entry point. Should be overridden in descendants.



29
30
31
# File 'lib/loops/command.rb', line 29

def execute
  raise 'Generic command has no actions'
end

#invoke(engine, options) ⇒ Object

Invoke a command.

Initiaizes #engine and #options variables and executes a command.



20
21
22
23
24
25
# File 'lib/loops/command.rb', line 20

def invoke(engine, options)
  @engine = engine
  @options = options

  execute
end

#requires_bootstrap?Boolean

Gets a value indicating whether command needs to bootstrap framework.

Returns:

  • (Boolean)


34
35
36
# File 'lib/loops/command.rb', line 34

def requires_bootstrap?
  true
end