Sha256: 099931bdda92d56c8ff9747a7920c45d6cbb8cf74ef9f0aa1ba3ef9c6dcd81fb
Contents?: true
Size: 586 Bytes
Versions: 3
Compression:
Stored size: 586 Bytes
Contents
# frozen_string_literal: true module ReSorcery module Maybe class Nothing include Fielded field :kind, :nothing, -> { :nothing } def and_then self end def map self end def or_else(&block) ArgCheck['block', block.call, Just, Nothing] end def get_or_else(&block) block.call end def assign(_name) self end def ==(other) other.class == Nothing end def as_json(*) { kind: :nothing, } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
re_sorcery-0.3.0 | lib/re_sorcery/maybe/nothing.rb |
re_sorcery-0.2.0 | lib/re_sorcery/maybe/nothing.rb |
re_sorcery-0.1.0 | lib/re_sorcery/maybe/nothing.rb |