Module: Cucumber::Core::Gherkin::AstBuilder::MultilineArgument

Extended by:
Gherkin::Rubify
Defined in:
lib/cucumber/core/gherkin/ast_builder.rb

Class Method Summary collapse

Class Method Details

.from(argument, parent_location) ⇒ Object



322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 322

def from(argument, parent_location)
  return Ast::EmptyMultilineArgument.new unless argument
  argument = rubify(argument)
  case argument
  when ::Gherkin::Formatter::Model::DocString
    Ast::DocString.new(argument.value, argument.content_type, parent_location.on_line(argument.line_range))
  when Array
    location = parent_location.on_line(argument.first.line..argument.last.line)
    Ast::DataTable.new(argument.map{|row| row.cells}, location)
  else
    raise ArgumentError, "Don't know how to convert #{argument.inspect} into a MultilineArgument"
  end
end