class CukeModeler::Gherkin19Adapter
@api private
An adapter that can convert the output of version 19.x of the cucumber-gherkin gem into input that is consumable by this gem. Internal helper class.
Public Instance Methods
adapt_doc_string(doc_string_ast)
click to toggle source
Adapts the AST sub-tree that is rooted at the given doc string node.
Calls superclass method
# File lib/cuke_modeler/adapters/gherkin_19_adapter.rb, line 29 def adapt_doc_string(doc_string_ast) adapted_doc_string = super adapted_doc_string['content_type'] = doc_string_ast[:mediaType] adapted_doc_string end
adapt_example(example_ast)
click to toggle source
Adapts the AST sub-tree that is rooted at the given example node.
Calls superclass method
# File lib/cuke_modeler/adapters/gherkin_19_adapter.rb, line 38 def adapt_example(example_ast) adapted_example = super clear_child_elements(adapted_example, [[:tableHeader], [:tableBody]]) adapted_example['rows'] << adapt_table_row(example_ast[:tableHeader]) if example_ast[:tableHeader] example_ast[:tableBody].each do |row| adapted_example['rows'] << adapt_table_row(row) end adapted_example end
adapt_step(step_ast)
click to toggle source
Adapts the AST sub-tree that is rooted at the given step node.
Calls superclass method
# File lib/cuke_modeler/adapters/gherkin_19_adapter.rb, line 13 def adapt_step(step_ast) adapted_step = super clear_child_elements(adapted_step, [[:dataTable], [:docString]]) if step_ast[:docString] adapted_step['doc_string'] = adapt_doc_string(step_ast[:docString]) elsif step_ast[:dataTable] adapted_step['table'] = adapt_step_table(step_ast[:dataTable]) end adapted_step end
Private Instance Methods
test_has_examples?(ast_node)
click to toggle source
# File lib/cuke_modeler/adapters/gherkin_19_adapter.rb, line 57 def test_has_examples?(ast_node) ast_node[:scenario][:examples].any? end