Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 90a8e66b72
Fetching contributors…

Cannot retrieve contributors at this time

file 78 lines (65 sloc) 1.534 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
require 'ixtlan/core/extra_headers'
require 'ixtlan/core/cache_headers'
require 'ixtlan/core/x_frame_headers'
require 'ixtlan/core/x_content_type_headers'
require 'ixtlan/core/x_xss_protection_headers'

class Controller
  
  def render(*args, &block)
    @render = args if args.size > 0
    @render
  end
  def send_file(*args, &block)
    @send_file = args if args.size > 0
    @send_file
  end
  def send_data(*args, &block)
    @send_data = args if args.size > 0
    @send_data
  end

  include Ixtlan::Core::ExtraHeaders
  include Ixtlan::Core::XFrameHeaders
  include Ixtlan::Core::XContentTypeHeaders
  include Ixtlan::Core::XXssProtectionHeaders
  include Ixtlan::Core::CacheHeaders

  def response
    unless @response
      @response = Object.new

      def @response.headers
        @headers ||= {}
      end
      def @response.status(st = nil)
        @status = st if st
        @status
      end
    end
    @response
  end

  def request
    unless @request
      @request = Object.new
      def @request.method(m = nil)
        @method = m if m
        @method
      end
    end
    @request
  end

end

class ControllerWithUser < Controller

  def initialize(user = nil, status = 200, method = :get)
    @user = user
    request.method method
    response.status status
  end
  def current_user
    @user
  end

end

class Rails

  class Config
    attr_accessor :x_content_type_headers, :x_frame_headers , :x_xss_protection_headers, :cache_headers
  end

  def self.configuration
    @config ||= Config.new
  end
end
Something went wrong with that request. Please try again.