Class: Protobuf::Node::EnumFieldNode

Inherits:
Base
  • Object
show all
Defined in:
lib/protobuf/compiler/nodes.rb

Instance Method Summary collapse

Methods inherited from Base

#accept_rpc_visitor, #define_in_the_file

Constructor Details

#initialize(name, value) ⇒ EnumFieldNode

Returns a new instance of EnumFieldNode.



172
173
174
# File 'lib/protobuf/compiler/nodes.rb', line 172

def initialize(name, value)
  @name, @value = name, value
end

Instance Method Details

#accept_descriptor_visitor(visitor) ⇒ Object



180
181
182
183
# File 'lib/protobuf/compiler/nodes.rb', line 180

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



176
177
178
# File 'lib/protobuf/compiler/nodes.rb', line 176

def accept_message_visitor(visitor)
  visitor.write "#{@name} = #{@value}"
end