Class: Bread::Manager::Actions::TopScope

Inherits:
Object
  • Object
show all
Defined in:
lib/bread/manager/actions/top_scope.rb

Instance Method Summary collapse

Constructor Details

#initializeTopScope

Returns a new instance of TopScope.



6
7
8
# File 'lib/bread/manager/actions/top_scope.rb', line 6

def initialize
  @controllers = {}
end

Instance Method Details

#controller(controller_path, options = {}, &block) ⇒ Object



10
11
12
13
14
15
# File 'lib/bread/manager/actions/top_scope.rb', line 10

def controller(controller_path, options={}, &block)
  controller_path = controller_path.to_s
  @controllers[controller_path] = controller_scope = ControllerScope.new(self, controller_path, options)
  controller_scope.instance_eval(&block)
  true
end

#get_controller_scope(controller_path) ⇒ Object



17
18
19
# File 'lib/bread/manager/actions/top_scope.rb', line 17

def get_controller_scope(controller_path)
  @controllers[controller_path.to_s] || raise("no controller #{controller_path} in #{@controllers.keys}")
end