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.



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

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

Instance Method Details

#indentObject



29
30
31
# File 'lib/ridlbe/ruby/walker.rb', line 29

def indent
  @indent * @nest
end

#nest(in_ = 1) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/ridlbe/ruby/walker.rb', line 33

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


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

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

#printi(str = '') ⇒ Object



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

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

#printiln(str = '') ⇒ Object



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

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



42
43
44
45
46
47
48
# File 'lib/ridlbe/ruby/walker.rb', line 42

def visit_nodes(parser)
  pre_visit(parser)

  parser.walk_nodes(self)

  post_visit(parser)
end