lib/json/add/dry/monads/maybe.rb in dry-monads-0.3.1 vs lib/json/add/dry/monads/maybe.rb in dry-monads-0.4.0
- old
+ new
@@ -17,10 +17,10 @@
# Returns a hash, that will be turned into a JSON object and represent this
# object.
def as_json(*)
{
JSON.create_id => self.class.name,
- value: value
+ value: none? ? nil : @value
}
end
# Stores class name (Dry::Monads::Maybe::Some or Dry::Monads::Maybe::None)
# with the monad value as JSON string