Sha256: f30aaf8f119b7b1e6fa5baf0a8f06deed20fb86fe6b53e476b28e29d14f48525

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

require 'facets/more/annotation'
require 'facets/more/inheritor'
require 'facets/more/aspects'

require 'nitro/markup'

require 'nitro'
require 'nitro/render'
require 'nitro/scaffolding'
require 'nitro/caching'
require 'nitro/flash'
require 'nitro/helper'
require 'nitro/compiler'
require 'nitro/publishable'

module Nitro

# The Controller part in the MVC paradigm. The controller's 
# published methods are called actrions. The controller class
# contains the Publishable mixin and additional helper mixins.

class Controller 
  include Publishable
  include Scaffolding
  include Caching
  include Helpers
  helper Nitro::Markup

  # This callback is called after the Controller is mounted.
  
  def self.mounted(path)
    # Resolve aspects.
    
    Aspects.include_advice_modules(self)
      
    # The scaffolding code is compiled after the mount, so 
    # that template roots are finalized.
    
    compile_scaffolding_code()
  end
  
  # Returns the current controller from the context thread local
  # variable.
    
  def self.current
    Thread.current[:CURRENT_CONTROLLER] 
  end    
  
  #--
  # Replaces the current controller (helper for render).
  # This is an internal method.
  #++
  
  def self.replace_current(controller) # :nodoc:
    old = Thread.current[:CURRENT_CONTROLLER]
    Thread.current[:CURRENT_CONTROLLER] = controller
    return old
  end

end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.41.0 lib/nitro/controller.rb
nitro-0.40.0 lib/nitro/controller.rb