Class: RspecStarter::CommandContext

Inherits:
StepContext show all
Defined in:
lib/rspec_starter/command_context.rb

Overview

CommandContext’s are created to when parsing the RspecStater.start block. They hold the args for Commands. They are asked to create instances of Command from this information when it is time to execute. The also resolve the options that each Command is allowed to access.

Instance Attribute Summary collapse

Attributes inherited from StepContext

#environment, #id, #requested_args

Instance Method Summary collapse

Constructor Details

#initialize(environment:, id:, command_string:, requested_args:) ⇒ CommandContext

Returns a new instance of CommandContext.



8
9
10
11
12
# File 'lib/rspec_starter/command_context.rb', line 8

def initialize(environment:, id:, command_string:, requested_args:)
  super(environment: environment, id: id, requested_args: requested_args)

  @command_string = command_string
end

Instance Attribute Details

#command_stringObject (readonly)

Returns the value of attribute command_string.



6
7
8
# File 'lib/rspec_starter/command_context.rb', line 6

def command_string
  @command_string
end

Instance Method Details

#instantiate(runner) ⇒ Object



14
15
16
# File 'lib/rspec_starter/command_context.rb', line 14

def instantiate(runner)
  Command.new(@id, runner, @command_string, build_options)
end

#is_command?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/rspec_starter/command_context.rb', line 26

def is_command?
  true
end

#is_task?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/rspec_starter/command_context.rb', line 22

def is_task?
  false
end

#step_classObject



18
19
20
# File 'lib/rspec_starter/command_context.rb', line 18

def step_class
  Command
end