Sha256: 0c998931f062fd8de758ca005a92f05e0c901eaa0b49276352d16c50989d98ed

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.2.0
class SmartCore::Types::Primitive::NilableValidator::Result
  # @return [Array]
  #
  # @api private
  # @since 0.2.0
  NO_INVARIANT_ERRORS = [].freeze

  # @return [SmartCore::Types::Primitive]
  #
  # @api public
  # @since 0.2.0
  attr_reader :type

  # @return [Any]
  #
  # @api public
  # @since 0.2.0
  attr_reader :checked_value
  alias_method :value, :checked_value

  # @param type [SmartCore::Types::Primitive]
  # @param checked_value [Any]
  # @return [void]
  #
  # @api private
  # @since 0.2.0
  def initialize(type, checked_value)
    @type = type
    @checked_value = checked_value
  end

  # @return [Boolean]
  #
  # @api public
  # @since 0.2.0
  def is_valid_check
    true
  end
  alias_method :valid_check?, :is_valid_check

  # @return [Array]
  #
  # @api public
  # @since 0.2.0
  def invariant_errors
    NO_INVARIANT_ERRORS
  end
  alias_method :errors, :invariant_errors
  alias_method :error_codes, :invariant_errors

  # @return [Boolean]
  #
  # @api public
  # @since 0.2.0
  def valid_invariants?
    true
  end

  # @return [Boolean]
  #
  # @api public
  # @since 0.2.0
  def success?
    true
  end

  # @return [Boolean]
  #
  # @api public
  # @since 0.2.0
  def failure?
    false
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
smart_types-0.8.0 lib/smart_core/types/primitive/nilable_validator/result.rb
smart_types-0.7.1 lib/smart_core/types/primitive/nilable_validator/result.rb
smart_types-0.7.0 lib/smart_core/types/primitive/nilable_validator/result.rb
smart_types-0.6.0 lib/smart_core/types/primitive/nilable_validator/result.rb
smart_types-0.4.0 lib/smart_core/types/primitive/nilable_validator/result.rb
smart_types-0.3.0 lib/smart_core/types/primitive/nilable_validator/result.rb
smart_types-0.2.0 lib/smart_core/types/primitive/nilable_validator/result.rb