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.
173 174 175 |
# File 'lib/protobuf/compiler/nodes.rb', line 173 def initialize(name, value) @name, @value = name, value end |
Instance Method Details
#accept_descriptor_visitor(visitor) ⇒ Object
181 182 183 184 |
# File 'lib/protobuf/compiler/nodes.rb', line 181 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
177 178 179 |
# File 'lib/protobuf/compiler/nodes.rb', line 177 def (visitor) visitor.write("define :#{@name}, #{@value}") end |