Sha256: 24588a488e99f1416d12577176c9160560249bf9cf8763674255da357d22ef32

Contents?: true

Size: 267 Bytes

Versions: 3

Compression:

Stored size: 267 Bytes

Contents

# frozen_string_literal: true

module JsonStatham
  module Requests
    class Reader < Base
      def call
        return {} unless File.exist?(file_path)

        JSON.parse(File.read(file_path))
      rescue JSON::ParserError
        {}
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json_statham-0.1.3 lib/json_statham/requests/reader.rb
json_statham-0.1.2 lib/json_statham/requests/reader.rb
json_statham-0.1.0 lib/json_statham/requests/reader.rb