Class: XapianDb::TypeCodec::BooleanCodec

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

Class Method Summary collapse

Class Method Details

.decode(string) ⇒ Boolean

Decode a string representing a boolean

Parameters:

  • string (String)

    a string

Returns:

  • (Boolean)

    the boolean value



83
84
85
# File 'lib/type_codec.rb', line 83

def self.decode(string)
  string == "true"
end

.encode(value) ⇒ String

Encode a boolean value to a string

Parameters:

  • value (Object)

    a value to encode

Returns:

  • (String)

    the string



76
77
78
# File 'lib/type_codec.rb', line 76

def self.encode(value)
  value.to_s
end