Represents an inline argument in a step. Example:
Given the message """ I like Cucumber sandwich """
The text between the pair of """
is stored
inside a DocString, which is yielded to the
StepDefinition block as the last argument.
The StepDefinition can then access the String via the to_s method. In the
example above, that would return: "I like\nCucumber
sandwich"
Note how the indentation from the source is stripped away.
# File lib/cucumber/core/ast/doc_string.rb, line 28 def initialize(content, content_type, location) @content = content @content_type = content_type @location = location super @content end
# File lib/cucumber/core/ast/doc_string.rb, line 53 def ==(other) if other.respond_to?(:content_type) return false unless content_type == other.content_type end if other.respond_to?(:to_str) return content == other.to_str end false end
# File lib/cucumber/core/ast/doc_string.rb, line 35 def data_table? false end
# File lib/cucumber/core/ast/doc_string.rb, line 39 def doc_string? true end
# File lib/cucumber/core/ast/doc_string.rb, line 63 def inspect [ %Q{#<#{self.class} (#{location})}, %Q{ """#{content_type}}, %Q{ #{@content}}, %Q{ """>} ].join("\n") end
# File lib/cucumber/core/ast/doc_string.rb, line 43 def map raise ArgumentError, "No block given" unless block_given? new_content = yield content self.class.new(new_content, content_type, location) end
# File lib/cucumber/core/ast/doc_string.rb, line 49 def to_step_definition_arg self end
# File lib/cucumber/core/ast/doc_string.rb, line 74 def description_for_visitors :doc_string end