Sha256: 4dc3fdeb722052890cf7c9f85b4941cf1c371934bd14dff5b73b277e2ec79d12

Contents?: true

Size: 832 Bytes

Versions: 5

Compression:

Stored size: 832 Bytes

Contents

module Lucid
  module AST
    class DocString < String #:nodoc:
      attr_accessor :file

      def self.default_arg_name
        'string'
      end

      attr_reader :content_type

      def initialize(string, content_type)
        @content_type = content_type
        super string
      end

      def to_step_definition_arg
        self
      end

      def accept(visitor)
        visitor.visit_doc_string(self)
      end

      def arguments_replaced(arguments) #:nodoc:
        string = self
        arguments.each do |name, value|
          value ||= ''
          string = string.gsub(name, value)
        end
        DocString.new(string, content_type)
      end

      def has_text?(text)
        index(text)
      end

      def to_sexp #:nodoc:
        [:doc_string, to_step_definition_arg]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lucid-0.5.1 lib/lucid/ast/doc_string.rb
lucid-0.4.1 lib/lucid/ast/doc_string.rb
lucid-0.4.0 lib/lucid/ast/doc_string.rb
lucid-0.3.3 lib/lucid/ast/doc_string.rb
lucid-0.3.0 lib/lucid/ast/doc_string.rb