Class: RspecStarter::TaskContext

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

Overview

TaskContext’s are created to when parsing the RspecStater.start block. They hold the ARGS and Task class name. They are asked to create instances of Task subclasses from this information when it is time to execute. The also resolve the options that each Task 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:, step_class:, requested_args:) ⇒ TaskContext

Returns a new instance of TaskContext.



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

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

  @step_class = step_class
end

Instance Attribute Details

#step_classObject (readonly)

Returns the value of attribute step_class.



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

def step_class
  @step_class
end

Instance Method Details

#instantiate(runner) ⇒ Object



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

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

#is_command?Boolean

Returns:

  • (Boolean)


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

def is_command?
  false
end

#is_task?Boolean

Returns:

  • (Boolean)


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

def is_task?
  true
end