Sha256: 90e728b2e0c7397135d047dbb67b5931430b1810353b921ba2d8833a766e4833

Contents?: true

Size: 442 Bytes

Versions: 29

Compression:

Stored size: 442 Bytes

Contents

class Object
  # def to_boolean
  #   return true if self.is_a?(TrueClass)

  #   respond_to?(:downcase) && ['true', 1, '1', 'yes', 't', 'y'].include?(self.downcase)
  # end
end

class String
  def to_boolean
    ['true', 1, '1', 'yes', 't', 'y'].include?(self.downcase)
  end
end

class NilClass
  def to_boolean
    false
  end
end

class FalseClass
  def to_boolean
    false
  end
end

class TrueClass
  def to_boolean
    true
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
symphonia-3.1.1 lib/symphonia/object.rb
symphonia-3.1.0 lib/symphonia/object.rb
symphonia-3.0.3 lib/symphonia/object.rb
symphonia-3.0.2 lib/symphonia/object.rb
symphonia-2.2.1 lib/symphonia/object.rb
symphonia-3.0.1 lib/symphonia/object.rb
symphonia-3.0.0 lib/symphonia/object.rb
symphonia-2.1.8 lib/symphonia/object.rb
symphonia-2.1.7 lib/symphonia/object.rb