module CZTop::Config::Serialization::ClassMethods

Some class methods for {Config} related to serialization.

Public Instance Methods

_load(string) click to toggle source

Loads a {Config} tree from a marshalled string. @note This method is automatically used by Marshal.load. @param string [String] marshalled {Config} @return [Config]

# File lib/cztop/config/serialization.rb, line 49
def _load(string)
  from_string(string)
end
from_string(string) click to toggle source

Loads a {Config} tree from a string. @param string [String] the tree @return [Config]

# File lib/cztop/config/serialization.rb, line 26
def from_string(string)
  from_ffi_delegate CZMQ::FFI::Zconfig.str_load(string)
end
load(path) click to toggle source

Loads a {Config} tree from a file. @param path [String, Pathname, to_s] the path to the ZPL config file @raise [SystemCallError] if this fails @return [Config]

# 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