Class: Takagi::CoAP::Registries::Option
- Defined in:
- lib/takagi/coap/registries/option.rb
Overview
CoAP Option Number Registry (RFC 7252 ยง5.10)
Extensible registry for CoAP option numbers. Plugins can register custom options without modifying core code.
Class Method Summary collapse
-
.critical?(number) ⇒ Boolean
Check if an option is critical Critical options must be understood by the recipient.
-
.no_cache_key?(number) ⇒ Boolean
Check if an option has NoCacheKey property.
-
.unsafe?(number) ⇒ Boolean
Check if an option is unsafe to forward.
-
.valid?(number) ⇒ Boolean
Check if option number is valid.
Methods inherited from Base
all, clear!, each_value, inherited, metadata_for, name_for, register, registered?, rfc_for, value_for, values
Class Method Details
.critical?(number) ⇒ Boolean
Check if an option is critical Critical options must be understood by the recipient
44 45 46 |
# File 'lib/takagi/coap/registries/option.rb', line 44 def self.critical?(number) number.allbits?(1) end |
.no_cache_key?(number) ⇒ Boolean
Check if an option has NoCacheKey property
58 59 60 |
# File 'lib/takagi/coap/registries/option.rb', line 58 def self.no_cache_key?(number) (number & 0x1E) == 0x1C end |
.unsafe?(number) ⇒ Boolean
Check if an option is unsafe to forward
51 52 53 |
# File 'lib/takagi/coap/registries/option.rb', line 51 def self.unsafe?(number) number.allbits?(2) end |
.valid?(number) ⇒ Boolean
Check if option number is valid
65 66 67 |
# File 'lib/takagi/coap/registries/option.rb', line 65 def self.valid?(number) number.between?(0, 65_535) end |