Class: Cucumberator::Commands::Where

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scenario, step_line) ⇒ Where

Returns a new instance of Where.



11
12
13
14
15
16
17
# File 'lib/cucumberator/commands/where.rb', line 11

def initialize(scenario, step_line)
  @feature_file = Cucumberator::FeatureFile.new(scenario)

  display_line(step_line - 1)
  display_line(step_line.number, current: true)
  display_line(step_line + 1)
end

Class Method Details

.perform(scenario, step_line, *args, &block) ⇒ Object

return value - wants to quit?



5
6
7
8
# File 'lib/cucumberator/commands/where.rb', line 5

def perform(scenario, step_line, *args, &block)
  new(scenario, step_line)
  false
end

Instance Method Details

#display_line(line_number, opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cucumberator/commands/where.rb', line 19

def display_line(line_number, opts = {})
  lines = @feature_file.lines
  line_string = sprintf("%3d", line_number)

  if opts[:current]
    line_string << ": -> "
  else
    line_string << ":    "
  end

  line_string << lines[line_number-1].to_s
  puts line_string
end