Class: Protobuf::Node::ProtoNode
- Defined in:
- lib/protobuf/compiler/nodes.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Instance Method Summary collapse
- #accept_descriptor_visitor(visitor) ⇒ Object
- #accept_message_visitor(visitor) ⇒ Object
- #accept_rpc_visitor(visitor) ⇒ Object
-
#initialize(children) ⇒ ProtoNode
constructor
A new instance of ProtoNode.
Methods inherited from Base
Constructor Details
#initialize(children) ⇒ ProtoNode
Returns a new instance of ProtoNode.
23 24 25 |
# File 'lib/protobuf/compiler/nodes.rb', line 23 def initialize(children) @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
21 22 23 |
# File 'lib/protobuf/compiler/nodes.rb', line 21 def children @children end |
Instance Method Details
#accept_descriptor_visitor(visitor) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/protobuf/compiler/nodes.rb', line 45 def accept_descriptor_visitor(visitor) descriptor = Google::Protobuf::FileDescriptorProto.new :name => visitor.filename visitor.file_descriptor = descriptor visitor.in_context descriptor do @children.map{|child| child.accept_descriptor_visitor visitor} end end |
#accept_message_visitor(visitor) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/protobuf/compiler/nodes.rb', line 27 def (visitor) visitor.write '### Generated by rprotoc. DO NOT EDIT!' visitor.write "### <proto file: #{visitor.proto_file}>" if visitor.attach_proto? visitor.write visitor.commented_proto_contents if visitor.attach_proto? visitor.write <<-eos require 'protobuf/message/message' require 'protobuf/message/enum' require 'protobuf/message/service' require 'protobuf/message/extend' eos @children.map{|child| child. visitor} visitor.close_ruby end |
#accept_rpc_visitor(visitor) ⇒ Object
41 42 43 |
# File 'lib/protobuf/compiler/nodes.rb', line 41 def accept_rpc_visitor(visitor) @children.map{|child| child.accept_rpc_visitor visitor} end |