Class: Cucumber::Runtime::SupportCode::StepInvoker

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/runtime/support_code.rb

Instance Method Summary collapse

Constructor Details

#initialize(support_code) ⇒ StepInvoker



16
17
18
# File 'lib/cucumber/runtime/support_code.rb', line 16

def initialize(support_code)
  @support_code = support_code
end

Instance Method Details

#multiline_arg(step, location) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cucumber/runtime/support_code.rb', line 29

def multiline_arg(step, location)
  argument = step[:argument]

  if argument
    if argument[:type] == :DocString
      MultilineArgument.from(argument[:content], location, argument[:content_type])
    else
      MultilineArgument::DataTable.from(argument[:rows].map { |row| row[:cells].map { |cell| cell[:value] } })
    end
  else
    MultilineArgument.from(nil)
  end
end

#step(step) ⇒ Object



24
25
26
27
# File 'lib/cucumber/runtime/support_code.rb', line 24

def step(step)
  location = Core::Ast::Location.of_caller
  @support_code.invoke_dynamic_step(step[:text], multiline_arg(step, location))
end

#steps(steps) ⇒ Object



20
21
22
# File 'lib/cucumber/runtime/support_code.rb', line 20

def steps(steps)
  steps.each { |step| step(step) }
end