module THTP::Encoding

Handling of registered MIME types and protocols

Constants

BINARY
COMPACT
JSON

Public Class Methods

content_type(protocol) click to toggle source
# File lib/thtp/encoding.rb, line 21
def self.content_type(protocol)
  # this can't be a case/when because Class !=== Class
  if protocol == Thrift::BinaryProtocol
    BINARY
  elsif protocol == Thrift::CompactProtocol
    COMPACT
  elsif protocol == Thrift::JsonProtocol
    JSON
  end
end
protocol(content_type) click to toggle source
# File lib/thtp/encoding.rb, line 10
def self.protocol(content_type)
  case content_type
  when BINARY
    Thrift::BinaryProtocol
  when COMPACT
    Thrift::CompactProtocol
  when JSON
    Thrift::JsonProtocol
  end
end