Sha256: 2a6a646ba6070cee6948b2ba4b878c628d15400f90e300f8d799836033844041

Contents?: true

Size: 271 Bytes

Versions: 4

Compression:

Stored size: 271 Bytes

Contents

class Typero::BooleanType < Typero::Type
  def default
    false
  end

  def set
    @value = [true, 1, '1', 'true', 'on'].include?(@value) ? true : false
  end

  def db_field
    opts = {}
    opts[:default]  = @opts[:default] || false
    [:boolean, opts]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
typero-0.8.1 ./lib/typero/type/types/boolean.rb
typero-0.8.0 ./lib/typero/type/types/boolean.rb
typero-0.7.0 ./lib/typero/type/boolean.rb
typero-0.5.2 ./lib/typero/type/boolean.rb