Class: TShield::Server

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Controllers::Requests::Helpers
Defined in:
lib/tshield/server.rb

Overview

Base of TShield Server

Class Method Summary collapse

Methods included from Controllers::Requests::Helpers

#add_headers, build_headers, #configuration, #delay, #domain, #treat, #treat_headers_by_domain

Class Method Details

.load_controllersObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/tshield/server.rb', line 44

def self.load_controllers
  return unless File.exist?('controllers')

  Dir.entries('controllers').each do |entry|
    next if entry =~ /^\.\.?$/

    entry.gsub!('.rb', '')
    require File.join('.', 'controllers', entry)
    controller_name = entry.split('_').collect(&:capitalize).join
    include Module.const_get("#{controller_name}::Actions")
    register Module.const_get(controller_name)
  end
end

.register_resourcesObject



38
39
40
41
42
# File 'lib/tshield/server.rb', line 38

def self.register_resources
  load_controllers
  register TShield::Controllers::Sessions
  register TShield::Controllers::Requests
end

.run!Object



58
59
60
61
# File 'lib/tshield/server.rb', line 58

def self.run!
  register_resources
  super
end