Sha256: c27a5913368985220ead368a0be6429fddb0917458a0d50f587c759cab282d37
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 KB
Contents
module Crystal module AbstractController inherit Filters inherit AbstractController::Render, AbstractController::Micelaneous inject( :workspace => :workspace, :logger => :logger, :config => :config ) def params workspace.params end module ClassMethods inject( :workspace => :workspace, :logger => :logger, :config => :config ) def controller_name self.namespace ? "#{self.namespace.name}/#{self.alias}" : self.alias end def controller_context_class unless @controller_context_class parent_context_class = nil ancestors[1..-1].each do |anc| break if parent_context_class = anc.respond_to(:controller_context_class) end parent_context_class ||= Crystal::ControllerContext class_name = "#{self.name}::#{self.name.split('::').last}ControllerContext" # raise "Tempate context #{class_name} already defined!" if Object.const_defined? class_name eval "class #{class_name} < #{parent_context_class}; end", TOPLEVEL_BINDING, __FILE__, __LINE__ @controller_context_class = class_name.constantize end @controller_context_class end def helper *args args.to_a.each do |mod| mod.must_be.a Module controller_context_class.inherit mod end end def helper_method *args args = args.first if args.size == 1 and args.first.is_a?(Array) # args.each{|m| m.to_s.must_be.in self.instance_methods} args.each do |m| controller_context_class.delegate m, :to => :controller end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
crystal-0.0.13 | lib/crystal/controller/abstract_controller.rb |
crystal-0.0.12 | lib/crystal/controller/abstract_controller.rb |
crystal_ext-0.0.11 | lib/crystal/controller/abstract_controller.rb |