lib/dry/monads/task.rb in dry-monads-1.2.0 vs lib/dry/monads/task.rb in dry-monads-1.3.0
- old
+ new
@@ -126,17 +126,21 @@
# @return [String]
def to_s
state = case promise.state
when :fulfilled
- "value=#{ value!.inspect }"
+ if Unit.equal?(value!)
+ 'value=()'
+ else
+ "value=#{value!.inspect}"
+ end
when :rejected
"error=#{ promise.reason.inspect }"
else
'?'
end
- "Task(#{ state })"
+ "Task(#{state})"
end
alias_method :inspect, :to_s
# Tranforms the error if the computation wasn't successful.
#