Class: Protobuf::Node::OptionNode

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_list, value) ⇒ OptionNode

Returns a new instance of OptionNode.



90
91
92
# File 'lib/protobuf/compiler/nodes.rb', line 90

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

Instance Method Details

#accept_descriptor_visitor(visitor) ⇒ Object



98
99
100
# File 'lib/protobuf/compiler/nodes.rb', line 98

def accept_descriptor_visitor(visitor)
  visitor.add_option @name_list.join('.'), @value
end

#accept_message_visitor(visitor) ⇒ Object



94
95
96
# File 'lib/protobuf/compiler/nodes.rb', line 94

def accept_message_visitor(visitor)
  visitor.write "::Protobuf::OPTIONS[:#{@name_list.join('.').inspect}] = #{@value.inspect}"
end