Sha256: cef7ec753371152abbda372c718e9e383a250ddca36c3391502fa4f30509ff59

Contents?: true

Size: 850 Bytes

Versions: 12

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.2.0
class Qonfig::Loaders::Basic
  class << self
    # @param data [String]
    # @return [void]
    #
    # @api private
    # @since 0.5.0
    def load(data)
      nil # NOTE: consciously return nil (for clarity)
    end

    # @return [void]
    #
    # @api private
    # @since 0.5.0
    def load_empty_data
      nil # NOTE: consciously return nil (for clarity)
    end

    # @param file_path [String]
    # @option fail_on_unexist [Boolean]
    # @return [Object]
    #
    # @raise [Qonfig::FileNotFoundError]
    #
    # @api private
    # @since 0.5.0
    def load_file(file_path, fail_on_unexist: true)
      load(::File.read(file_path))
    rescue Errno::ENOENT => error
      fail_on_unexist ? (raise Qonfig::FileNotFoundError, error.message) : load_empty_data
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
qonfig-0.20.0 lib/qonfig/loaders/basic.rb
qonfig-0.19.1 lib/qonfig/loaders/basic.rb
qonfig-0.19.0 lib/qonfig/loaders/basic.rb
qonfig-0.18.1 lib/qonfig/loaders/basic.rb
qonfig-0.18.0 lib/qonfig/loaders/basic.rb
qonfig-0.17.0 lib/qonfig/loaders/basic.rb
qonfig-0.16.0 lib/qonfig/loaders/basic.rb
qonfig-0.15.0 lib/qonfig/loaders/basic.rb
qonfig-0.14.0 lib/qonfig/loaders/basic.rb
qonfig-0.13.0 lib/qonfig/loaders/basic.rb
qonfig-0.12.0 lib/qonfig/loaders/basic.rb
qonfig-0.11.0 lib/qonfig/loaders/basic.rb