Sha256: 08e0ca837caded951bf0230a1a70075de2d97f7b6c5aa3c84c8f9b7ee4eb63c2

Contents?: true

Size: 301 Bytes

Versions: 10

Compression:

Stored size: 301 Bytes

Contents

# frozen_string_literal: true

require 'active_record'

class Boolean
  def self.parse(value)
    ActiveRecord::Type::Boolean.new.cast(value)
  end

  def self.strict_parse(value)
    !!parse(value)
  end
end

class Object
  def yes_no_to_s
    !!self == self ? (self ? 'yes' : 'no') : to_s
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
better_record-0.10.1 lib/core_ext/boolean.rb
better_record-0.10.0 lib/core_ext/boolean.rb
better_record-0.9.3 lib/core_ext/boolean.rb
better_record-0.9.1 lib/core_ext/boolean.rb
better_record-0.9.0 lib/core_ext/boolean.rb
better_record-0.8.6 lib/core_ext/boolean.rb
better_record-0.8.5 lib/core_ext/boolean.rb
better_record-0.8.4 lib/core_ext/boolean.rb
better_record-0.8.3 lib/core_ext/boolean.rb
better_record-0.8.2 lib/core_ext/boolean.rb