Sha256: 9f4081794a1b9d950b4c3836e9656b9728a051c16f22094e18c232d52edad474
Contents?: true
Size: 1.42 KB
Versions: 4
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true require 'delegate' require 'cucumber/multiline_argument/data_table' require 'cucumber/multiline_argument/doc_string' module Cucumber module MultilineArgument class << self def from_core(node) builder.wrap(node) end def from(argument, location = nil, content_type = nil) location ||= Core::Ast::Location.of_caller case argument when String builder.doc_string(Core::Ast::DocString.new(argument, content_type, location)) 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 private def builder @builder ||= Builder.new end class Builder def wrap(node) @result = None.new node.describe_to(self) @result end def doc_string(node, *_args) @result = DocString.new(node) end def data_table(node, *_args) @result = DataTable.new(node) end end end class None def append_to(array) end def describe_to(visitor) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems