Sha256: d9c8a2751f69ddfd060247338ff8d50348848d51d7e00d7d691ecca705a6f3f5

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

require 'singleton'

module Monad
  module Maybe
    class Nothing < Base
      include ::Singleton
  
      def method_missing(method, *args)
        self
      end
  
      def clone
        self
      end
  
      def inspect
        'nothing'
      end
  
      def nil?
        true
      end
  
      def nothing?
        true
      end
  
      def bind(fn)
        self
      end

      def just?
        false
      end

      def something?
        false
      end
  
      def unwrap(val)
        val
      end
  
      def value
        nil
      end
  
      def to_s
        ''
      end
      alias to_str to_s

      def to_a
        []
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monad-maybe-0.9.9 lib/monad/maybe/nothing.rb