Module: Cucumber::MultilineArgument

Extended by:
Gherkin::Rubify
Defined in:
lib/cucumber/multiline_argument.rb,
lib/cucumber/multiline_argument/data_table.rb,
lib/cucumber/multiline_argument/doc_string.rb

Defined Under Namespace

Classes: Builder, DataTable, DocString, None

Class Method Summary collapse

Class Method Details

.data_table(data, location) ⇒ Object



37
38
39
# File 'lib/cucumber/multiline_argument.rb', line 37

def data_table(data, location)
  builder.data_table(Core::Ast::DataTable.new(data, location))
end

.doc_string(argument, content_type, location) ⇒ Object



33
34
35
# File 'lib/cucumber/multiline_argument.rb', line 33

def doc_string(argument, content_type, location)
  builder.doc_string(Core::Ast::DocString.new(argument, content_type, location))
end

.from(argument, location = nil) ⇒ Object



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

def from(argument, location=nil)
  location ||= Core::Ast::Location.of_caller
  argument = rubify(argument)
  case argument
  when String
    doc_string(argument, 'text/plain', location)
  when Array
    location = location.on_line(argument.first.line..argument.last.line)
    data_table(argument.map{ |row| row.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



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

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