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



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

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

#accept_message_visitor(visitor) ⇒ Object



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

def accept_message_visitor(visitor)
  visitor.package = @path_list.dup
  @path_list.each do |path|
    visitor.write("module #{Util.camelize(path)}")
    visitor.increment
  end
end

#accept_rpc_visitor(visitor) ⇒ Object



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

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