Sha256: 95bf47eb0ee1107ac3f7599581ca60f88d9d42468fcb0b7476cffb3f6bf00d2d

Contents?: true

Size: 503 Bytes

Versions: 2

Compression:

Stored size: 503 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
      _aref CONTENT_TYPE
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 lib/nyara/hashes/header_hash.rb
nyara-0.1.pre.1 lib/nyara/hashes/header_hash.rb