Module: BSON::Registry
Overview
Provides constant values for each to the BSON types and mappings from raw bytes back to these types.
Constant Summary collapse
- MAPPINGS =
A Mapping of all the BSON types to their corresponding Ruby classes.
{}
Instance Method Summary collapse
-
#get(byte) ⇒ Class
Get the class for the single byte identifier for the type in the BSON specification.
-
#register(byte, type) ⇒ Class
Register the Ruby type for the corresponding single byte.
Instance Method Details
#get(byte) ⇒ Class
Get the class for the single byte identifier for the type in the BSON specification.
42 43 44 |
# File 'lib/bson/registry.rb', line 42 def get(byte) MAPPINGS.fetch(byte) end |
#register(byte, type) ⇒ Class
Register the Ruby type for the corresponding single byte.
57 58 59 60 |
# File 'lib/bson/registry.rb', line 57 def register(byte, type) MAPPINGS.store(byte, type) define_type_reader(type) end |