Class: RD::Reference

Inherits:
NonterminalInline show all
Defined in:
lib/rd/inline-element.rb

Defined Under Namespace

Classes: Label, RDLabel, TemporaryLabel, URL

Instance Attribute Summary collapse

Attributes inherited from NonterminalInline

#content

Attributes included from NonterminalElement

#temporary_document_structure

Attributes inherited from Element

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NonterminalInline

#children

Methods included from NonterminalElement

#add_child, #add_child_under_document_struct, #add_children, #add_children_under_document_struct, #add_children_without_document_struct, #build, #children, #each_child, #each_element, #make_child, #push_to_children, #under_temporary_document_structure

Methods inherited from Element

#inspect, #tree

Constructor Details

#initialize(label) ⇒ Reference

Returns a new instance of Reference.



105
106
107
108
109
# File 'lib/rd/inline-element.rb', line 105

def initialize(label)
  super()
  @content = []
  @label = label.renew_label
end

Instance Attribute Details

#labelObject

Reference::Label



102
103
104
# File 'lib/rd/inline-element.rb', line 102

def label
  @label
end

Class Method Details

.new_from_label(label) ⇒ Object



111
112
113
114
115
# File 'lib/rd/inline-element.rb', line 111

def Reference.new_from_label(label)
  ref = Reference.new(label)
  ref.add_children(label.to_reference_content)
  return ref
end

.new_from_label_under_document_struct(label, struct) ⇒ Object



117
118
119
120
121
122
# File 'lib/rd/inline-element.rb', line 117

def Reference.new_from_label_under_document_struct(label, struct)
  ref = Reference.new(label)
  ref.add_children_under_document_struct(label.to_reference_content,
	     struct)
  return ref
end

.new_from_label_without_document_struct(label) ⇒ Object



124
125
126
127
128
# File 'lib/rd/inline-element.rb', line 124

def Reference.new_from_label_without_document_struct(label)
  ref = Reference.new(label)
  ref.add_children_without_document_struct(label.to_reference_content)
  return ref
end

Instance Method Details

#accept(visitor) ⇒ Object



130
131
132
# File 'lib/rd/inline-element.rb', line 130

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

#result_of_apply_method_of(visitor, children) ⇒ Object



134
135
136
# File 'lib/rd/inline-element.rb', line 134

def result_of_apply_method_of(visitor, children)
  label.result_of_apply_method_of(visitor, self, children)
end

#to_labelObject



138
139
140
# File 'lib/rd/inline-element.rb', line 138

def to_label
  @label.to_label
end