Sha256: 70af22467e90aee7493d168950fb29428e7b176a7a910f05524a9f57709e5250
Contents?: true
Size: 535 Bytes
Versions: 26
Compression:
Stored size: 535 Bytes
Contents
class Numeric # Provides a boolean interpretation of self. # If self == 0 then false else true. # # 0.to_b #=> false # 1.to_b #=> true # 2.3.to_b #=> true # def to_b self == 0 ? false : true end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCNumeric < Test::Unit::TestCase def test_to_b assert_equal( false, 0.to_b ) assert_equal( true, 1.to_b ) end end =end
Version data entries
26 entries across 26 versions & 1 rubygems