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.



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

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

Instance Method Details

#accept_descriptor_visitor(visitor) ⇒ Object



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

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

#accept_message_visitor(visitor) ⇒ Object



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

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