lib/ribimaybe.rb in ribimaybe-0.0.11 vs lib/ribimaybe.rb in ribimaybe-0.0.12
- old
+ new
@@ -18,14 +18,16 @@
"Nothing"
end
alias_method :inspect, :to_s
- # Compares a Just to another Maybe.
+ # Compares a Nothing to another Maybe.
#
# ==== Attributes
#
+ # * +other+ - The other Maybe value.
+ #
Contract Or[Nothing, Just] => Bool
def self.===(other)
self == other
end
@@ -48,10 +50,14 @@
Contract Any => Nothing
def self.apply(_)
self
end
+ class << self
+ alias_method :>>, :apply
+ end
+
# No operation. Always returns Nothing.
#
Contract Proc => Nothing
def self.bind(&_)
self
@@ -141,9 +147,11 @@
#
Contract Or[Nothing, Just] => Or[Nothing, Just]
def apply(value)
value.map { |v| @value.curry.(v) }
end
+
+ alias_method :>>, :apply
# Applies fn to value inside Just (note contract constraint).
#
# ==== Attributes
#