Sha256: f7e41d5ff37f7c182e575aa37d1aa474dd03b08c9f952562ada5a6bfb0462c5a

Contents?: true

Size: 832 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
lucid-0.2.1 lib/lucid/ast/doc_string.rb
lucid-0.2.0 lib/lucid/ast/doc_string.rb
lucid-0.1.1 lib/lucid/ast/doc_string.rb
lucid-0.1.0 lib/lucid/ast/doc_string.rb