Sha256: 5acb5e8e50b3bae21a568af411165506dc1735f4e14327aad7dd7c64eb6a6e9e
Contents?: true
Size: 993 Bytes
Versions: 1
Compression:
Stored size: 993 Bytes
Contents
require 'happy/routing' require 'happy/actions' require 'happy/rackable' module Happy class Controller include Routing include Actions include Rackable attr_reader :options, :env delegate :request, :response, :remaining_path, :params, :session, :render, :url_for, :to => :context def initialize(env = nil, options = {}, &blk) @env = env @options = options instance_exec(&blk) if blk end def perform context.with_controller(self) do route end end private def context @env['happy.context'] ||= self.class.context_class.from_env(@env) end def route instance_exec(&self.class.route_blk) if self.class.route_blk end class << self attr_reader :route_blk def route(&blk) @route_blk = blk end def context(&blk) context_class.class_exec(&blk) end def context_class Happy::Context end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
happy-0.1.0.pre.1 | lib/happy/controller.rb |