Sha256: ebf43c11329030edb16b2812c00081cb70a2a6a983e412ab4405215f964bff7e

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  # Represent a boolean object.
  #
  # @api private
  #
  class Boolean

    # @return [Boolean]
    def self.coerce(value = nil)
      new(value).coerce
    end

    # @param value [void]
    # @return [Vedeu::Boolean]
    def initialize(value = nil)
      @value = value
    end

    # @return [Boolean]
    def coerce
      value ? true : false
    end

    # @return [Boolean]
    def false?
      value.nil? || value == false
    end

    # @return [Boolean]
    def true?
      return false if false?

      true
    end

    private

    # @!attribute [r] value
    # @return [void]
    attr_reader :value

  end # Boolean

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.8.30 lib/vedeu/boolean.rb
vedeu-0.8.29 lib/vedeu/boolean.rb
vedeu-0.8.28 lib/vedeu/boolean.rb
vedeu-0.8.27 lib/vedeu/boolean.rb
vedeu-0.8.26 lib/vedeu/boolean.rb
vedeu-0.8.25 lib/vedeu/boolean.rb