Class: Protobuf::Node::ServiceNode

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

Instance Method Summary collapse

Methods inherited from Base

#define_in_the_file

Constructor Details

#initialize(name, children) ⇒ ServiceNode

Returns a new instance of ServiceNode.



188
189
190
# File 'lib/protobuf/compiler/nodes.rb', line 188

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

Instance Method Details

#accept_descriptor_visitor(visitor) ⇒ Object



201
202
203
204
205
206
207
# File 'lib/protobuf/compiler/nodes.rb', line 201

def accept_descriptor_visitor(visitor)
  descriptor = Google::Protobuf::ServiceDescriptorProto.new(:name => @name.to_s)
  visitor.service_descriptor = descriptor
  visitor.in_context(descriptor) do
    @children.each {|child| child.accept_descriptor_visitor(visitor) }
  end
end

#accept_message_visitor(visitor) ⇒ Object



192
193
194
# File 'lib/protobuf/compiler/nodes.rb', line 192

def accept_message_visitor(visitor)
  # do nothing
end

#accept_rpc_visitor(visitor) ⇒ Object



196
197
198
199
# File 'lib/protobuf/compiler/nodes.rb', line 196

def accept_rpc_visitor(visitor)
  visitor.current_service = @name
  @children.each {|child| child.accept_rpc_visitor(visitor) }
end