Module: CZTop::Config::Serialization::ClassMethods
- Included in:
- CZTop::Config
- Defined in:
- lib/cztop/config/serialization.rb
Overview
Some class methods for CZTop::Config related to serialization.
Instance Method Summary collapse
-
#_load(string) ⇒ Config
Loads a CZTop::Config tree from a marshalled string.
-
#from_string(string) ⇒ Config
Loads a CZTop::Config tree from a string.
-
#load(path) ⇒ Config
Loads a CZTop::Config tree from a file.
Instance Method Details
#_load(string) ⇒ Config
Note:
This method is automatically used by Marshal.load.
Loads a CZTop::Config tree from a marshalled string.
49 50 51 |
# File 'lib/cztop/config/serialization.rb', line 49 def _load(string) from_string(string) end |
#from_string(string) ⇒ Config
Loads a CZTop::Config tree from a string.
26 27 28 |
# File 'lib/cztop/config/serialization.rb', line 26 def from_string(string) from_ffi_delegate CZMQ::FFI::Zconfig.str_load(string) end |
#load(path) ⇒ Config
Loads a CZTop::Config tree from a file.
35 36 37 38 39 40 41 42 |
# File 'lib/cztop/config/serialization.rb', line 35 def load(path) ptr = CZMQ::FFI::Zconfig.load(path.to_s) return from_ffi_delegate(ptr) unless ptr.null? CZTop::HasFFIDelegate.raise_zmq_err( format('error while reading the file %p', path.to_s) ) end |