Sha256: 0528ae17330823146480eb02a0bfe0c162c7d25cafc8b9d1179d48cc3e51214b

Contents?: true

Size: 469 Bytes

Versions: 2

Compression:

Stored size: 469 Bytes

Contents

require 'forwardable'

module Dolly
  class HeaderRequest
    extend Forwardable

    CONTENT_TYPE_KEY = 'Content-Type'
    JSON_CONTENT = 'application/json'

    def_delegators :@collection, :[], :[]=, :keys, :each

    def initialize hash = nil
      @collection = hash || default_value
    end

    def json?
      @collection[CONTENT_TYPE_KEY] == JSON_CONTENT
    end

    private

    def default_value
      { CONTENT_TYPE_KEY => JSON_CONTENT }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dolly-3.0.1 lib/dolly/request_header.rb
dolly-3.0.0 lib/dolly/request_header.rb