Class: Protobuf::Node::ExtendNode

Inherits:
Base
  • Object
show all
Defined in:
lib/protobuf/compiler/nodes.rb

Instance Method Summary (collapse)

Methods inherited from Base

#accept_rpc_visitor, #define_in_the_file

Constructor Details

- (ExtendNode) initialize(name, children)

Returns a new instance of ExtendNode



128
129
130
# File 'lib/protobuf/compiler/nodes.rb', line 128

def initialize(name, children)
  @name, @children = name, children
end

Instance Method Details

- (Object) accept_descriptor_visitor(visitor)



142
143
144
# File 'lib/protobuf/compiler/nodes.rb', line 142

def accept_descriptor_visitor(visitor)
  # TODO: how should i handle this?
end

- (Object) accept_message_visitor(visitor)



132
133
134
135
136
137
138
139
140
# File 'lib/protobuf/compiler/nodes.rb', line 132

def accept_message_visitor(visitor)
  name = @name.is_a?(Array) ? @name.join : name.to_s
  visitor.write("class #{Util.modulize(name)} < ::Protobuf::Message")
  visitor.in_context(self.class) do
    define_in_the_file(visitor)
    @children.each {|child| child.accept_message_visitor(visitor) }
  end
  visitor.write('end')
end