### Home Classes Methods

### In Files

- lib/amalgalite/boolean.rb

### Parent

Object

### Methods

- ::false_values
- ::to_bool
- ::true_values

### Files

- HISTORY.rdoc
- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Amalgalite
- Amalgalite::Aggregate
- Amalgalite::Blob
- Amalgalite::Blob::Error
- Amalgalite::Boolean
- Amalgalite::BusyHandler
- Amalgalite::BusyTimeout
- Amalgalite::CSVTableImporter
- Amalgalite::Column
- Amalgalite::Database
- Amalgalite::Database::AggregateError
- Amalgalite::Database::BusyHandlerError
- Amalgalite::Database::FunctionError
- Amalgalite::Database::InvalidModeError
- Amalgalite::Database::ProgressHandlerError
- Amalgalite::Database::TransactionBehavior
- Amalgalite::Error
- Amalgalite::Function
- Amalgalite::Index
- Amalgalite::MemoryDatabase
- Amalgalite::Packer
- Amalgalite::Paths
- Amalgalite::ProfileSampler
- Amalgalite::ProfileTap
- Amalgalite::ProgressHandler
- Amalgalite::Requires
- Amalgalite::SQLite3
- Amalgalite::SQLite3::Constants
- Amalgalite::SQLite3::Constants::Config
- Amalgalite::SQLite3::Constants::DBStatus
- Amalgalite::SQLite3::Constants::DataType
- Amalgalite::SQLite3::Constants::Helpers
- Amalgalite::SQLite3::Constants::Open
- Amalgalite::SQLite3::Constants::ResultCode
- Amalgalite::SQLite3::Constants::StatementStatus
- Amalgalite::SQLite3::Constants::Status
- Amalgalite::SQLite3::Database
- Amalgalite::SQLite3::Database::DBStatus
- Amalgalite::SQLite3::Database::Function
- Amalgalite::SQLite3::Database::Stat
- Amalgalite::SQLite3::Stat
- Amalgalite::SQLite3::Status
- Amalgalite::SQLite3::Version
- Amalgalite::Schema
- Amalgalite::Statement
- Amalgalite::Table
- Amalgalite::Taps
- Amalgalite::Taps::IO
- Amalgalite::Taps::Stderr
- Amalgalite::Taps::Stdout
- Amalgalite::Taps::StringIO
- Amalgalite::TraceTap
- Amalgalite::TypeMap
- Amalgalite::TypeMaps
- Amalgalite::TypeMaps::DefaultMap
- Amalgalite::TypeMaps::StorageMap
- Amalgalite::TypeMaps::TextMap
- Amalgalite::Version
- Amalgalite::View
- Kernel
- Object

No matching classes.

# Amalgalite::Boolean

Do type conversion on values that could be boolen values into real 'true' or 'false'

This is pulled from the possible boolean values from PostgreSQL

### Public Class Methods

false_values() click to toggle source

list of downcased strings are potential false values

    # File lib/amalgalite/boolean.rb, line 24
    def false_values
      @false_values ||= ] false f no n 0 ]
    end

to_bool( val ) click to toggle source

Convert `val` to a string and attempt to convert it to `true` or `false`

    # File lib/amalgalite/boolean.rb, line 31
    def to_bool( val )
      return false if val.nil?
      unless defined? @to_bool
        @to_bool = {}
        true_values.each  { |t| @to_bool[t] = true  }
        false_values.each { |f| @to_bool[f] = false }
      end
      return @to_bool[val.to_s.downcase]
    end

true_values() click to toggle source

list of downcased strings are potential true values

    # File lib/amalgalite/boolean.rb, line 17
    def true_values
      @true_values ||= ] true t yes y 1 ]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.