Sha256: 1bce1c25954553d3f8d99abb00d8e0275c7e4e421990c675c3374cde2c450de0

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

module Fluxo
  class << self
    def config
      @config ||= Config.new
      yield(@config) if block_given?
      @config
    end
    alias_method :configure, :config
  end

  class Config
    attr_reader :error_handlers

    # When set to true, the result of a falsey operation will be wrapped in a Failure.
    attr_accessor :wrap_falsey_result

    # When set to true, the result of a truthy operation will be wrapped in a Success.
    attr_accessor :wrap_truthy_result

    # Auto handle errors/exceptions.
    attr_writer :strict

    def initialize
      @error_handlers = []
      @wrap_falsey_result = false
      @wrap_truthy_result = false
      @strict = false
    end

    def strict?
      !!@strict
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluxo-0.3.0 lib/fluxo/config.rb