Class: IcAgent::Ast::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/ic_agent/ast/writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(tree) ⇒ Writer

Returns a new instance of Writer.



4
5
6
# File 'lib/ic_agent/ast/writer.rb', line 4

def initialize(tree)
  @tree = tree
end

Instance Method Details

#write(return_type = :string) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/ic_agent/ast/writer.rb', line 8

def write(return_type = :string)
  if return_type == :tree
    @tree
  elsif return_type == :array
    @tree.to_array
  else
    @tree.to_s
  end
end