Sha256: b24ca1176a9406b8d7ee4dd5f0eb3574086a17db443f64805ec593c21a749afb

Contents?: true

Size: 873 Bytes

Versions: 7

Compression:

Stored size: 873 Bytes

Contents

# frozen_string_literal: true

require 'singleton'

module Micro
  class Case
    class Config
      include Singleton

      def enable_transitions=(value)
        Micro::Case::Result.class_variable_set(
          :@@transitions_enabled, Kind::Of::Boolean(value)
        )
      end

      def enable_activemodel_validation=(value)
        return unless Kind::Of::Boolean(value)

        require 'micro/case/with_activemodel_validation'
      end

      def set_activemodel_validation_errors_failure=(value)
        return unless value

        @activemodel_validation_errors_failure = Kind.of(Symbol, value)
      end

      def activemodel_validation_errors_failure
        return @activemodel_validation_errors_failure if defined?(@activemodel_validation_errors_failure)

        @activemodel_validation_errors_failure = :invalid_attributes
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
u-case-4.2.2 lib/micro/case/config.rb
u-case-4.2.1 lib/micro/case/config.rb
u-case-4.2.0 lib/micro/case/config.rb
u-case-4.1.1 lib/micro/case/config.rb
u-case-4.1.0 lib/micro/case/config.rb
u-case-4.0.0 lib/micro/case/config.rb
u-case-3.1.0 lib/micro/case/config.rb