Class: Protobuf::Node::PackageNode

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(path_list) ⇒ PackageNode

Returns a new instance of PackageNode.



69
70
71
# File 'lib/protobuf/compiler/nodes.rb', line 69

def initialize(path_list)
  @path_list = path_list
end

Instance Method Details

#accept_descriptor_visitor(visitor) ⇒ Object



84
85
86
# File 'lib/protobuf/compiler/nodes.rb', line 84

def accept_descriptor_visitor(visitor)
  visitor.current_descriptor.package = @path_list.join '.'
end

#accept_message_visitor(visitor) ⇒ Object



73
74
75
76
77
78
# File 'lib/protobuf/compiler/nodes.rb', line 73

def accept_message_visitor(visitor)
  @path_list.each do |path|
    visitor.write "module #{path.to_s.capitalize}"
    visitor.increment
  end
end

#accept_rpc_visitor(visitor) ⇒ Object



80
81
82
# File 'lib/protobuf/compiler/nodes.rb', line 80

def accept_rpc_visitor(visitor)
  visitor.package = @path_list.dup
end