Module: Cucumber::MultilineArgument

Defined in:
lib/cucumber/multiline_argument.rb,
lib/cucumber/multiline_argument/data_table.rb,
lib/cucumber/multiline_argument/doc_string.rb,
lib/cucumber/multiline_argument/data_table/diff_matrices.rb

Defined Under Namespace

Classes: Builder, DataTable, DocString, None

Class Method Summary collapse

Class Method Details

.from(argument, location = nil, content_type = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cucumber/multiline_argument.rb', line 14

def from(argument, location = nil, content_type = nil)
  location ||= Core::Test::Location.of_caller
  case argument
  when String
    builder.doc_string(Core::Test::DocString.new(argument, content_type))
  when Array
    location = location.on_line(argument.first.line..argument.last.line)
    builder.data_table(argument.map(&:cells), location)
  when DataTable, DocString, None
    argument
  when nil
    None.new
  else
    raise ArgumentError, "Don't know how to convert #{argument.class} #{argument.inspect} into a MultilineArgument"
  end
end

.from_core(node) ⇒ Object



10
11
12
# File 'lib/cucumber/multiline_argument.rb', line 10

def from_core(node)
  builder.wrap(node)
end