Class: RD::OutputFormatVisitor

Inherits:
Visitor
  • Object
show all
Includes:
SearchFile
Defined in:
lib/rd2odt/rdtool/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.



16
17
18
19
20
# File 'lib/rd2odt/rdtool/rd/output-format-visitor.rb', line 16

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

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



14
15
16
# File 'lib/rd2odt/rdtool/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/rd2odt/rdtool/rd/output-format-visitor.rb', line 13

def include_suffix
  @include_suffix
end

Instance Method Details

#apply_to_Include(element) ⇒ Object



22
23
24
25
26
# File 'lib/rd2odt/rdtool/rd/output-format-visitor.rb', line 22

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