alsemyonov/unboolean

View on GitHub
lib/unboolean/core_ext/true_class.rb

Summary

Maintainability
A
50 mins
Test Coverage
require 'unboolean'
require 'unboolean/maybe'

class TrueClass
  def &(other)
    other.is_a?(Unboolean::Maybe) ? other & self : !!(other)
  end

  def ^(other)
    other.is_a?(Unboolean::Maybe) ? other ^ self : (!other).is_a?(TrueClass)
  end

  def ==(other)
    other.is_a?(Unboolean::Maybe) ? other == self : (!!other).is_a?(TrueClass)
  end
end