Module: Sparsam

Defined in:
lib/sparsam.rb,
lib/sparsam/types.rb,
lib/sparsam/union.rb,
lib/sparsam/struct.rb,
lib/sparsam/base_type.rb,
lib/sparsam/exceptions.rb,
lib/sparsam/base_struct.rb,
lib/sparsam/deserializer.rb,
lib/sparsam/application_exception.rb,
ext/ruby_hooks.c

Defined Under Namespace

Modules: BaseStruct, BaseType, Deserializer, StructInitialization, Types Classes: ApplicationException, Exception, MissingMandatory, Serializer, Struct, TypeMismatch, Union, UnionException, UnknownTypeException

Constant Summary collapse

TYPE_NAME_SYM_MAPPING =
Types.constants.each_with_object({}) do |const, h|
  h[Types.const_get(const)] = const.to_sym
end
TYPE_NAME_MAPPING =
TYPE_NAME_SYM_MAPPING.each_with_object({}) do |(k, const), h|
  h[k] = "Types::#{const}".freeze
end.freeze
CompactProtocol =
INT2FIX(compact)
BinaryProtocol =
INT2FIX(binary)
UNION =
INT2FIX(t_union)
STRUCT =
INT2FIX(t_struct)
NORMAL =
INT2FIX(normal)
STRICT =
INT2FIX(strict)
RECURSIVE =
INT2FIX(recursive)

Class Method Summary collapse

Class Method Details

.cache_fieldsObject

.init!Object



21
22
23
24
# File 'ext/ruby_hooks.c', line 21

static VALUE sparsam_init_bang(VALUE self) {
  initialize_runtime_constants();
  return self;
}

.type_name(type) ⇒ Object



39
40
41
# File 'lib/sparsam/types.rb', line 39

def self.type_name(type)
  TYPE_NAME_MAPPING[type]
end

.type_name_sym(type) ⇒ Object



35
36
37
# File 'lib/sparsam/types.rb', line 35

def self.type_name_sym(type)
  TYPE_NAME_SYM_MAPPING[type]
end

.validate(klass, data, strictness) ⇒ Object

Deprecated



15
16
17
18
# File 'lib/sparsam.rb', line 15

def self.validate(klass, data, strictness)
  data.serialize
  true
end