Class: Cucumber::Runtime::ForProgrammingLanguages

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cucumber/runtime/for_programming_languages.rb

Overview

This is what a programming language will consider to be a runtime.

It’s a thin class that directs the handul of methods needed by the programming languages to the right place.

Instance Method Summary collapse

Constructor Details

#initialize(support_code, user_interface) ⇒ ForProgrammingLanguages

Returns a new instance of ForProgrammingLanguages.



14
15
16
# File 'lib/cucumber/runtime/for_programming_languages.rb', line 14

def initialize(support_code, user_interface)
  @support_code, @user_interface = support_code, user_interface
end

Instance Method Details

#doc_string(body, content_type = '', line_offset = 0) ⇒ Object

Returns a Cucumber::MultilineArgument::DocString for body.



58
59
60
61
# File 'lib/cucumber/runtime/for_programming_languages.rb', line 58

def doc_string(body, content_type='', line_offset=0)
  location = Core::Ast::Location.of_caller
  MultilineArgument.doc_string(body, content_type, location)
end

#table(text_or_table, file = nil, line = 0) ⇒ Object

Returns a Cucumber::MultilineArgument::DataTable for text_or_table, which can either be a String:

table(%{
  | account | description | amount |
  | INT-100 | Taxi        | 114    |
  | CUC-101 | Peeler      | 22     |
})

or a 2D Array:

table([
  %w{ account description amount },
  %w{ INT-100 Taxi        114    },
  %w{ CUC-101 Peeler      22     }
])


47
48
49
50
51
52
53
54
# File 'lib/cucumber/runtime/for_programming_languages.rb', line 47

def table(text_or_table, file=nil, line=0)
  if !file
    location = Core::Ast::Location.of_caller
  else
    location = Core::Ast::Location.new(file, line)
  end
  MultilineArgument::DataTable.from(text_or_table, location)
end