Module: CoRE::CoAP::Registry
- Defined in:
- lib/core/coap/registry.rb
Constant Summary collapse
- REGISTRY_PATH =
File.join(File.dirname(__FILE__), 'registry').freeze
- CONTENT_FORMATS =
load_yaml(:content_formats).freeze
- CONTENT_FORMATS_INVERTED =
CONTENT_FORMATS.invert.freeze
Class Method Summary collapse
Class Method Details
.convert_content_format(cf) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/core/coap/registry.rb', line 14 def self.convert_content_format(cf) if cf.is_a? String CONTENT_FORMATS_INVERTED[cf] || without_charset(cf) else CONTENT_FORMATS[cf] end end |
.load_yaml(registry) ⇒ Object
6 7 8 9 |
# File 'lib/core/coap/registry.rb', line 6 def self.load_yaml(registry) registry = "#{registry}.yml" YAML.load_file(File.join(REGISTRY_PATH, registry)) end |