Sha256: 3139c004d4dfd44799d5a8211621c9631ab84356c73a263afd5b335292cfbff8

Contents?: true

Size: 580 Bytes

Versions: 5

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

module Fear
  # Represents lack of value. It's typically returned when function completed without a value.
  #
  # @example
  #   if user.valid?
  #     Fear.right(Fear::Unit)
  #   else
  #     Fear.left(user.errors)
  #   end
  #
  # @example
  #   def sent_notifications(user)
  #     # ...
  #     Fear::Unit
  #   end
  #
  Unit = Object.new.tap do |unit|
    # @return [String]
    def unit.to_s
      "#<Fear::Unit>"
    end

    # @return [String]
    def unit.inspect
      "#<Fear::Unit>"
    end
  end.freeze

  public_constant :Unit
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fear-3.0.0 lib/fear/unit.rb
fear-2.0.1 lib/fear/unit.rb
fear-2.0.0 lib/fear/unit.rb
fear-1.2.0 lib/fear/unit.rb
fear-1.1.0 lib/fear/unit.rb