Sha256: 96b6cbb54d431ab893965e92940755867077d2c41afa7e213b96a26af7ba4181

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

module ActiveData
  module Model
    module Extensions
      module Boolean
        extend ActiveSupport::Concern

        MAPPING = {
          "1" => true,
          "0" => false,
          "t" => true,
          "f" => false,
          "T" => true,
          "F" => false,
          "true" => true,
          "false" => false,
          "TRUE" => true,
          "FALSE" => false
        }

        module ClassMethods
          def modelize value
            MAPPING[value.to_s]
          end
        end
      end
    end
  end
end

Boolean.send :include, ActiveData::Model::Extensions::Boolean

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_data-0.0.1 lib/active_data/model/extensions/boolean.rb