Module: Paquito

Defined in:
lib/paquito.rb,
lib/paquito/types.rb,
lib/paquito/errors.rb,
lib/paquito/struct.rb,
lib/paquito/version.rb,
lib/paquito/deflater.rb,
lib/paquito/allow_nil.rb,
lib/paquito/safe_yaml.rb,
lib/paquito/compressor.rb,
lib/paquito/coder_chain.rb,
lib/paquito/typed_struct.rb,
lib/paquito/codec_factory.rb,
lib/paquito/translate_errors.rb,
lib/paquito/cache_entry_coder.rb,
lib/paquito/serialized_column.rb,
lib/paquito/active_record_coder.rb,
lib/paquito/comment_prefix_version.rb,
lib/paquito/conditional_compressor.rb,
lib/paquito/flat_cache_entry_coder.rb,
lib/paquito/single_byte_prefix_version.rb,
lib/paquito/types/active_record_packer.rb,
lib/paquito/single_byte_prefix_version_with_string_bypass.rb

Defined Under Namespace

Modules: CacheEntryCoder, Struct, TypedStruct, Types Classes: ActiveRecordCoder, AllowNil, CodecFactory, CoderChain, CommentPrefixVersion, Compressor, ConditionalCompressor, Deflater, FlatCacheEntryCoder, PackError, SafeYAML, SerializedColumn, SingleBytePrefixVersion, SingleBytePrefixVersionWithStringBypass, TranslateErrors

Constant Summary collapse

DEFAULT_FORMAT_VERSION =
0
Error =
Class.new(StandardError)
UnpackError =
Class.new(Error)
ClassMissingError =
Class.new(Error)
UnsupportedType =
Class.new(Error)
UnsupportedCodec =
Class.new(Error)
VersionMismatchError =
Class.new(Error)
VERSION =
"0.11.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.format_versionObject

Returns the value of attribute format_version.



36
37
38
# File 'lib/paquito.rb', line 36

def format_version
  @format_version
end

Class Method Details

.allow_nil(coder) ⇒ Object



54
55
56
# File 'lib/paquito.rb', line 54

def allow_nil(coder)
  AllowNil.new(coder)
end

.cast(coder) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/paquito.rb', line 38

def cast(coder)
  if coder.respond_to?(:load) && coder.respond_to?(:dump)
    coder
  elsif coder.respond_to?(:deflate) && coder.respond_to?(:inflate)
    Deflater.new(coder)
  elsif coder.respond_to?(:compress) && coder.respond_to?(:decompress)
    Compressor.new(coder)
  else
    raise TypeError, "Coders must respond to #dump and #load, #{coder.inspect} doesn't"
  end
end

.chain(*coders) ⇒ Object



50
51
52
# File 'lib/paquito.rb', line 50

def chain(*coders)
  CoderChain.new(*coders)
end