Class: RD::OutputFormatVisitor

Inherits:
Visitor
  • Object
show all
Includes:
SearchFile
Defined in:
lib/rd/output-format-visitor.rb

Direct Known Subclasses

RDVisitor

Constant Summary collapse

OUTPUT_SUFFIX =

must-have constants

""
INCLUDE_SUFFIX =
[]

Constants inherited from Visitor

Visitor::SYSTEM_NAME, Visitor::SYSTEM_VERSION, Visitor::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SearchFile

#search_file

Methods inherited from Visitor

define_visit_Nonterminal, define_visit_Terminal, version, #visit, #visit_DescListItem, #visit_MethodListItem, #visit_Reference, #visit_children

Constructor Details

#initializeOutputFormatVisitor

Returns a new instance of OutputFormatVisitor.



17
18
19
20
21
22
# File 'lib/rd/output-format-visitor.rb', line 17

def initialize
  super
  @include_suffix = self.class::INCLUDE_SUFFIX.clone
  @filename = nil
  @input_filename = "-"
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



14
15
16
# File 'lib/rd/output-format-visitor.rb', line 14

def filename
  @filename
end

#include_suffixObject

Returns the value of attribute include_suffix.



13
14
15
# File 'lib/rd/output-format-visitor.rb', line 13

def include_suffix
  @include_suffix
end

#input_filenameObject

Returns the value of attribute input_filename.



15
16
17
# File 'lib/rd/output-format-visitor.rb', line 15

def input_filename
  @input_filename
end

Instance Method Details

#apply_to_Include(element) ⇒ Object



24
25
26
27
28
# File 'lib/rd/output-format-visitor.rb', line 24

def apply_to_Include(element)
  fname = search_file(element.filename, element.tree.include_paths,
 @include_suffix)
  File.readlines(fname).join("") if fname
end