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.



16
17
18
# File 'lib/protobuf/message/message.rb', line 16

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

Instance Method Details

#[]=(key, value) ⇒ Object

Raises:

  • (RangeError)


20
21
22
23
# File 'lib/protobuf/message/message.rb', line 20

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

#include_tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/protobuf/message/message.rb', line 25

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