Class: XapianDb::TypeCodec

Inherits:
Object
  • Object
show all
Extended by:
Utilities
Defined in:
lib/type_codec.rb

Defined Under Namespace

Classes: BooleanCodec, DateCodec, DateTimeCodec, IntegerCodec, JsonCodec, NumberCodec, StringCodec

Class Method Summary collapse

Methods included from Utilities

assert_valid_keys, camelize, constantize

Class Method Details

.codec_for(type) ⇒ DateCodec

Get the codec for a type

Parameters:

  • type (Symbol)

    a supported type as a string or symbol. The following types are supported:

    - :date
    

Returns:



19
20
21
22
23
24
25
# File 'lib/type_codec.rb', line 19

def self.codec_for(type)
  begin
    constantize "XapianDb::TypeCodec::#{camelize("#{type}_codec")}"
  rescue NameError
    raise ArgumentError.new "no codec defined for type #{type}"
  end
end