Class: Protobuf::Message::ExtensionFields

Inherits:
Hash
  • Object
show all
Defined in:
lib/protobuf/message/message.rb

Instance Method Summary collapse

Constructor Details

#initialize(key_range = 0..-1)) ⇒ ExtensionFields

Returns a new instance of ExtensionFields.



14
15
16
# File 'lib/protobuf/message/message.rb', line 14

def initialize(key_range=0..-1)
  @key_range = key_range
end

Instance Method Details

#[]=(key, value) ⇒ Object

Raises:

  • (RangeError)


18
19
20
21
# File 'lib/protobuf/message/message.rb', line 18

def []=(key, value)
  raise RangeError, "#{key} is not in #{@key_range}" unless @key_range.include?(key)
  super
end

#include_tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/protobuf/message/message.rb', line 23

def include_tag?(tag)
  @key_range.include?(tag)
end