Sha256: 8efa23cc2e1b18b51665e64b891ac46e6cbb9faa2ea38616421750e7c66314a2

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

# frozen_string_literal: true

module Omdb
  module Api
    class Error
      ERROR_ATTRIBUTES = %i[
        response
        error
      ].freeze

      attr_reader(*ERROR_ATTRIBUTES)

      def initialize(response)
        attrs(response)
      end

      def attrs(response)
        response.each_key do |key|
          instance_variable_set("@#{key.downcase}".to_sym, response[key])
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omdb-api-1.0.0 lib/omdb/api/error.rb