lib/rumonade/option.rb in rumonade-0.2.0 vs lib/rumonade/option.rb in rumonade-0.2.1
- old
+ new
@@ -38,11 +38,11 @@
# @abstract
class Option
class << self
# @return [Option] Returns an +Option+ containing the given value
def unit(value)
- Rumonade.Option(value)
+ Rumonade.Some(value)
end
# @return [Option] Returns the empty +Option+
def empty
None
@@ -99,10 +99,10 @@
def ==(other)
other.is_a?(Some) && other.value == value
end
def to_s
- "Some(#{value.to_s})"
+ "Some(#{value.nil? ? 'nil' : value.to_s})"
end
end
# Represents an Option which is empty, accessed via the constant None
class NoneClass < Option