Class: IDL::RubyWriterBase

Inherits:
Object
  • Object
show all
Defined in:
lib/ridlbe/ruby/walker.rb

Direct Known Subclasses

RubyServantWriter, RubyStubWriter

Instance Method Summary collapse

Constructor Details

#initialize(output = STDOUT, params = {}, indent = " ") ⇒ RubyWriterBase

Returns a new instance of RubyWriterBase.



15
16
17
18
19
20
# File 'lib/ridlbe/ruby/walker.rb', line 15

def initialize(output = STDOUT, params = {}, indent = "  ")
  @output = output
  @params = params
  @indent = indent
  @nest = 0
end

Instance Method Details

#indentObject



26
27
28
# File 'lib/ridlbe/ruby/walker.rb', line 26

def indent()
  @indent * @nest
end

#nest(in_ = 1) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/ridlbe/ruby/walker.rb', line 29

def nest(in_ = 1)
  @nest += in_
  begin
    yield
  ensure
    @nest -= in_
  end
end


22
# File 'lib/ridlbe/ruby/walker.rb', line 22

def print(str);       @output << str; end

#printi(str = "") ⇒ Object



24
# File 'lib/ridlbe/ruby/walker.rb', line 24

def printi(str="");   @output << indent() << str; end

#printiln(str = "") ⇒ Object



25
# File 'lib/ridlbe/ruby/walker.rb', line 25

def printiln(str=""); @output << indent() << str << "\n"; end

#println(str = "") ⇒ Object



23
# File 'lib/ridlbe/ruby/walker.rb', line 23

def println(str="");  @output << str << "\n"; end

#visit_nodes(parser) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/ridlbe/ruby/walker.rb', line 38

def visit_nodes(parser)
  pre_visit(parser)

  parser.walk_nodes(self)

  post_visit(parser)
end