Class: Protobuf::Node::EnumFieldNode
- Defined in:
- lib/protobuf/compiler/nodes.rb
Instance Method Summary collapse
- #accept_descriptor_visitor(visitor) ⇒ Object
- #accept_message_visitor(visitor) ⇒ Object
-
#initialize(name, value) ⇒ EnumFieldNode
constructor
A new instance of EnumFieldNode.
Methods inherited from Base
#accept_rpc_visitor, #define_in_the_file
Constructor Details
#initialize(name, value) ⇒ EnumFieldNode
Returns a new instance of EnumFieldNode.
174 175 176 |
# File 'lib/protobuf/compiler/nodes.rb', line 174 def initialize(name, value) @name, @value = name, value end |
Instance Method Details
#accept_descriptor_visitor(visitor) ⇒ Object
182 183 184 185 |
# File 'lib/protobuf/compiler/nodes.rb', line 182 def accept_descriptor_visitor(visitor) descriptor = Google::Protobuf::EnumValueDescriptorProto.new :name => @name.to_s, :number => @value visitor.enum_value_descriptor = descriptor end |
#accept_message_visitor(visitor) ⇒ Object
178 179 180 |
# File 'lib/protobuf/compiler/nodes.rb', line 178 def (visitor) visitor.write "#{@name} = #{@value}" end |