Class: Cucumberator::CurrentStep

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumberator/current_step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ CurrentStep

Returns a new instance of CurrentStep.



8
9
10
11
12
# File 'lib/cucumberator/current_step.rb', line 8

def initialize(environment)
  @environment = environment
  @offset = 0
  set_line
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



6
7
8
# File 'lib/cucumberator/current_step.rb', line 6

def environment
  @environment
end

#lineObject

Returns the value of attribute line.



5
6
7
# File 'lib/cucumberator/current_step.rb', line 5

def line
  @line
end

#offsetObject

Returns the value of attribute offset.



5
6
7
# File 'lib/cucumberator/current_step.rb', line 5

def offset
  @offset
end

Instance Method Details

#current_sexpObject



23
24
25
# File 'lib/cucumberator/current_step.rb', line 23

def current_sexp
  scenario_sexp[offset]
end

#increaseObject



18
19
20
21
# File 'lib/cucumberator/current_step.rb', line 18

def increase
  self.offset += 1
  set_line
end

#scenario_sexpObject



14
15
16
# File 'lib/cucumberator/current_step.rb', line 14

def scenario_sexp
  @scenario_sexp ||= environment.to_sexp.select { |identificator, _| identificator == :step_invocation }
end

#set_lineObject



27
28
29
# File 'lib/cucumberator/current_step.rb', line 27

def set_line
  self.line = Cucumberator::StepLine.new(current_sexp[1]) if current_sexp
end