Module: Boolean
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
false < true.
-
#to_i ⇒ Integer
false⇒0true⇒1.
Instance Method Details
#<=>(other) ⇒ Integer
false < true
19 20 21 22 23 24 25 |
# File 'lib/is-boolean.rb', line 19 def <=>(other) if other.is_a?(Boolean) self.to_i <=> other.to_i else nil end end |
#to_i ⇒ Integer
false ⇒ 0 true ⇒ 1
9 10 11 12 13 14 15 |
# File 'lib/is-boolean.rb', line 9 def to_i if self 1 else 0 end end |