Module: CoRE::CoAP::Utility
- Included in:
- CoRE::CoAP
- Defined in:
- lib/core/coap/utility.rb
Instance Method Summary collapse
- #critical?(option) ⇒ Boolean
- #empty_buffer ⇒ Object
- #invert_into_hash(a) ⇒ Object
- #no_cache_key?(option) ⇒ Boolean
- #unsafe?(option) ⇒ Boolean
Instance Method Details
#critical?(option) ⇒ Boolean
12 13 14 15 16 17 |
# File 'lib/core/coap/utility.rb', line 12 def critical?(option) if oi = CoAP::OPTIONS_I[option] # this is really an option name symbol option = oi[0] # -> to option number end option.odd? end |
#empty_buffer ⇒ Object
4 5 6 |
# File 'lib/core/coap/utility.rb', line 4 def empty_buffer String.new # Was: ''.encode(BIN) end |
#invert_into_hash(a) ⇒ Object
8 9 10 |
# File 'lib/core/coap/utility.rb', line 8 def invert_into_hash(a) a.each_with_index.each_with_object({}) { |k, h| h[k[0]] = k[1] if k[0] } end |