Sha256: 39cfb0af27d5a08e88103b46da71732071ae39bcd74a7ddf301910b4f1aec7e8

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

module Nyara
  # This is a hash that Keys ignore case, and values all string, suitable for use in http header<br>
  # TODO check invalid chars in values<br>
  # TODO integrate extra lines
  class HeaderHash
    alias has_key? key?

    CONTENT_TYPE = 'Content-Type'.freeze

    def aref_content_type
      self._aref CONTENT_TYPE
    end

    def aset_content_type value
      unless value.index 'charset'
        value = "#{value}; charset=UTF-8"
      end
      self._aset CONTENT_TYPE, value
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nyara-0.1.pre.0 lib/nyara/hashes/header_hash.rb
nyara-0.0.1.pre.9 lib/nyara/hashes/header_hash.rb