Sha256: cc97e397dd792f860356e728b3efb58dd9bf364d70987facd3a6270cf618cbbc

Contents?: true

Size: 835 Bytes

Versions: 6

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

module Qonfig
  module Loaders
    # @api private
    # @sicne 0.5.0
    module Basic
      # @param data [String]
      # @return [void]
      #
      # @api private
      # @since 0.5.0
      def load(data)
        nil
      end

      # @return [void]
      #
      # @api private
      # @since 0.5.0
      def load_empty_data
        nil
      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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qonfig-0.10.0 lib/qonfig/loaders/basic.rb
qonfig-0.9.0 lib/qonfig/loaders/basic.rb
qonfig-0.8.0 lib/qonfig/loaders/basic.rb
qonfig-0.7.0 lib/qonfig/loaders/basic.rb
qonfig-0.6.0 lib/qonfig/loaders/basic.rb
qonfig-0.5.0 lib/qonfig/loaders/basic.rb