Class: Protobuf::Node::ExtensionsNode
- Defined in:
- lib/protobuf/compiler/nodes.rb
Instance Method Summary collapse
- #accept_descriptor_visitor(visitor) ⇒ Object
- #accept_message_visitor(visitor) ⇒ Object
-
#initialize(range) ⇒ ExtensionsNode
constructor
A new instance of ExtensionsNode.
Methods inherited from Base
#accept_rpc_visitor, #define_in_the_file
Constructor Details
#initialize(range) ⇒ ExtensionsNode
Returns a new instance of ExtensionsNode.
279 280 281 |
# File 'lib/protobuf/compiler/nodes.rb', line 279 def initialize(range) @range = range end |
Instance Method Details
#accept_descriptor_visitor(visitor) ⇒ Object
287 288 289 290 291 292 293 294 295 |
# File 'lib/protobuf/compiler/nodes.rb', line 287 def accept_descriptor_visitor(visitor) descriptor = Google::Protobuf::DescriptorProto::ExtensionRange.new :start => @range.first.low case @range.first.high when NilClass; # ignore when :max; descriptor.end = 1 else; descriptor.end = @range.first.high end visitor.extension_range_descriptor = descriptor end |
#accept_message_visitor(visitor) ⇒ Object
283 284 285 |
# File 'lib/protobuf/compiler/nodes.rb', line 283 def (visitor) visitor.write "extensions #{@range.first.to_s}" end |