Sha256: 0ffccf79f769acec81596ee9786dfd45180b45c5b658904b54f3321b6ad9d038

Contents?: true

Size: 867 Bytes

Versions: 6

Compression:

Stored size: 867 Bytes

Contents

# -*- encoding: utf-8 -*-

# A specialized container for storing header name / value pairs for a Stomp
# {Stomper::Frame Frame}.  This container behaves much like a +Hash+, but
# is specialized for the Stomp protocol.  Header names are always converted
# into +String+s through the use of +to_s+ and may have more than one value
# associated with them.
#
# @note Header names are case sensitive, therefore the names 'header'
#   and 'Header' will not refer to the same values.
# @see Stomper::Support::Ruby1_8::Headers Implementation for Ruby 1.8.7
# @see Stomper::Support::Ruby1_9::Headers Implementation for Ruby 1.9
class Stomper::Headers
  include ::Enumerable
  
  # Returns a new +Hash+ object associating symbolized header names and their
  # principle values.
  # @return [Hash]
  def to_hash
    to_a.inject({}) { |h, (k,v)| h[k.to_sym] ||= v; h }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stomper-2.0.6 lib/stomper/headers.rb
stomper-2.0.5 lib/stomper/headers.rb
stomper-2.0.4 lib/stomper/headers.rb
stomper-2.0.3 lib/stomper/headers.rb
stomper-2.0.2 lib/stomper/headers.rb
stomper-2.0.1 lib/stomper/headers.rb