class ThriftRack::Server

Public Class Methods

children() click to toggle source
# File lib/thrift_rack/server.rb, line 15
def children
  @children ||= []
end
inherited(subclass) click to toggle source
Calls superclass method
# File lib/thrift_rack/server.rb, line 8
def inherited(subclass)
  warn "Your class should end with Server not it is #{subclass}" unless subclass.name.end_with?("Server")
  @children ||= []
  @children << subclass
  super
end
inspect() click to toggle source
Calls superclass method
# File lib/thrift_rack/server.rb, line 19
def inspect
  return super if self == ThriftRack::Server
  "#{self.name}(processor_class=#{self.processor_class},mount_path=#{self.mount_path})"
end
mount_path() click to toggle source
# File lib/thrift_rack/server.rb, line 37
def mount_path
  return thrift_namespace unless /^[A-Z]/ =~ thrift_namespace
  path = thrift_namespace.scan(/[A-Z][a-z]*/).join("_").downcase
  "/#{path}"
end
new(request = nil) click to toggle source
# File lib/thrift_rack/server.rb, line 3
def initialize(request = nil)
  @_request = request
end
processor_class() click to toggle source
# File lib/thrift_rack/server.rb, line 24
def processor_class
  promissory_class_name = "Thrift::#{thrift_namespace}::#{thrift_namespace}Service::Processor"
  if Kernel.const_defined?(promissory_class_name)
    Kernel.const_get(promissory_class_name)
  else
    raise "You should overwrite processor_class for #{self}"
  end
end
protocol_factory() click to toggle source
# File lib/thrift_rack/server.rb, line 33
def protocol_factory
  Thrift::CompactProtocolFactory.new
end
thrift_namespace() click to toggle source
# File lib/thrift_rack/server.rb, line 43
def thrift_namespace
  @thrift_namespace ||= self.name.scan(/[^\:]+$/).first.to_s.gsub(/Server$/, "").freeze
end