class Frozen::Rack::RequestController
Attributes
site[RW]
Public Class Methods
new(site)
click to toggle source
# File lib/frozen/rack/request_controller.rb, line 5 def initialize(site) @site = site end
Public Instance Methods
call(env)
click to toggle source
# File lib/frozen/rack/request_controller.rb, line 8 def call(env) file_path = env["PATH_INFO"] engine = get_stylesheet(file_path) if get_stylesheet(file_path) engine = get_view(file_path) if get_view(file_path) engine = get_javascript(file_path) if get_javascript(file_path) return [200, {"Content-Type" => "text/html"}, [engine.render]] end
get_javascript(file_path)
click to toggle source
# File lib/frozen/rack/request_controller.rb, line 27 def get_javascript(file_path) site.javascripts.find { |v| site.javascripts.find { |i| i.build_file_path == file_path.sub(/^\//,'') } } end
get_stylesheet(file_path)
click to toggle source
# File lib/frozen/rack/request_controller.rb, line 15 def get_stylesheet(file_path) site.stylesheets.find { |s| s.build_file_path == file_path.sub(/^\//,'') } end
get_view(file_path)
click to toggle source
# File lib/frozen/rack/request_controller.rb, line 20 def get_view(file_path) site.views.find { |v| v.build_file_path == file_path.sub(/^\//,'') || v.build_file_path == File.join(file_path, "index.html").sub(/^\//,'') } end