class Blobsterix::AppRouterBase

Attributes

env[RW]

Public Class Methods

call(env) click to toggle source
# File lib/blobsterix/router/app_router.rb, line 58
def self.call(env)
  Blobsterix::StatusInfo.connections+=1
  # print_ram_usage("RAM USAGE Before")
  result=router.call(env)
  # print_ram_usage("RAM USAGE After")
  Blobsterix::StatusInfo.connections-=1
  result
end
call_controller(options, env) click to toggle source
# File lib/blobsterix/router/app_router.rb, line 72
def self.call_controller(options, env)
  options[:controller].respond_to?(options[:function]) ? options[:controller].send(options[:function], env) : Blobsterix.const_get(options[:controller]).new(env).send(options[:function])
end
http_verbs() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 47
def self.http_verbs
  @http_verbs||=["GET", "POST", "PUT", "DELETE", "HEAD"]
end
new(env) click to toggle source
# File lib/blobsterix/router/app_router.rb, line 10
def initialize(env)
  @env = env
end
options(opt) click to toggle source
# File lib/blobsterix/router/app_router.rb, line 42
def self.options(opt)
  opt = {:function => opt.to_sym} if opt.class != Hash
  {:controller => self.name, :function => :call}.merge(opt)
end
print_ram_usage(text) click to toggle source

Only use this function if you really have to it slows down the whole system

Private Class Methods

router() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 81
def self.router()
  (@@router ||= {})[self.name] ||= Journey::Router.new routes, {}
end
routes() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 77
def self.routes()
  (@@routes ||= {})[self.name] ||= Journey::Routes.new
end

Public Instance Methods

cache() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 18
def cache
  @cache ||= Blobsterix.cache
end
next_api() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 26
def next_api
  Http.NextApi
end
render(template_name, status_code=200, bind=nil) click to toggle source
# File lib/blobsterix/router/app_router.rb, line 34
def render(template_name, status_code=200, bind=nil)
  begin
    Http.Response(status_code, renderer.render(template_name, bind||binding), "html")
  rescue Errno::ENOENT => e
    Http.NotFound
  end
end
renderer() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 30
def renderer
  @@renderer||=TemplateRenderer.create(binding)
end
storage() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 14
def storage
  @storage ||= Blobsterix.storage
end
transformation() click to toggle source
# File lib/blobsterix/router/app_router.rb, line 22
def transformation
  @transformation ||= Blobsterix.transformation
end