class StompPublisher::Header
Constants
- ESCAPES
Public Class Methods
new(headers = {})
click to toggle source
# File lib/stomp_publisher/header.rb, line 22 def initialize(headers = {}) initialize_http_header(headers) end
parse(header_text)
click to toggle source
# File lib/stomp_publisher/header.rb, line 14 def self.parse(header_text) header = self.new header_text.each_line do |line| header.add_field(*line.chomp.split(":", 2)) end header end
Public Instance Methods
decode(value)
click to toggle source
# File lib/stomp_publisher/header.rb, line 36 def decode(value) ESCAPES.inject(value.to_s) { |value, (from, to)| value.gsub(to, from) } end
encode(value)
click to toggle source
# File lib/stomp_publisher/header.rb, line 32 def encode(value) ESCAPES.inject(value.to_s) { |value, (from, to)| value.gsub(from, to) } end
to_s()
click to toggle source
# File lib/stomp_publisher/header.rb, line 26 def to_s each_name.flat_map do |key| get_fields(key).map { |value| "#{encode(key)}:#{encode(value)}" } end * "\n" end