Class: Lucid::AST::DocString

Inherits:
String show all
Defined in:
lib/lucid/ast/doc_string.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from String

#indent

Constructor Details

#initialize(string, content_type) ⇒ DocString

Returns a new instance of DocString.



12
13
14
15
# File 'lib/lucid/ast/doc_string.rb', line 12

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

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



10
11
12
# File 'lib/lucid/ast/doc_string.rb', line 10

def content_type
  @content_type
end

#fileObject

Returns the value of attribute file.



4
5
6
# File 'lib/lucid/ast/doc_string.rb', line 4

def file
  @file
end

Class Method Details

.default_arg_nameObject



6
7
8
# File 'lib/lucid/ast/doc_string.rb', line 6

def self.default_arg_name
  'string'
end

Instance Method Details

#accept(visitor) ⇒ Object



21
22
23
# File 'lib/lucid/ast/doc_string.rb', line 21

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

#arguments_replaced(arguments) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
32
# File 'lib/lucid/ast/doc_string.rb', line 25

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

#has_text?(text) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/lucid/ast/doc_string.rb', line 34

def has_text?(text)
  index(text)
end

#to_sexpObject

:nodoc:



38
39
40
# File 'lib/lucid/ast/doc_string.rb', line 38

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

#to_step_definition_argObject



17
18
19
# File 'lib/lucid/ast/doc_string.rb', line 17

def to_step_definition_arg
  self
end