Picombo is a Rack-based Ruby MVC web framework with design principles taken from the Kohana PHP Framework.
It’s designed to be fast, lightweight and easy to use.
Picombo supports automatic class autoloading. This depends on the directory structure of Picombo. It has a few standard structures:
classes/ config/ controllers/ hooks/ models/ views/
This is the location that general classes go in the filesystem.
These class names must be in the Picombo module to be properly autoloaded.
This is where config items go. All config files except the Route file should be YAML to be read properly.
This is where controllers go (See the controllers doc for more information).
These class names should be in the Picombo::Controllers module to be properly autoloaded.
Hooks go here. You can use hooks to extend/replace/expand system functionality. Hooks run before anything else in the system setup process.
This is where your models go (See the models doc for more information).
These class names should be in the Picombo::Models module to be properly autoloaded.
This is where views go (See the Stache docs for specific usage).
If you write a Picombo extension, it’s important to know that all extensions should follow this same directory layout. In Picombo, all standard filesystem locations are searched from application first, through the extension list, and finally down to the core system folder. This lets you easily extend and replace functionality with extensions.
As long as your files/classes are setup as above, autoloading will “just work”. There’s one special case, however: underscores in class names. When you have an underscore in your class name, it will be translated to a directory seperator.
class Picombo::Controllers::Foo_Bar
lives in:
controllers/foo/bar.rb
and
class Picombo::Cache_Memcache
lives in:
classes/cache/memcache.rb
In a typical Picombo request here’s how a request get’s processed:
URI comes in from the browser to the server, and is passes to the Router
The router processes the URI using the routes.rb config file to do any special routing
The routed URI is the then processed by the appropriate controller
The controller processes any input, works with Views and Models to generate the request output
This is where the magic happens!
Autoloader for missing Picombo classes
# File lib/core/core.rb, line 211
211: def Picombo.const_missing(name)
212: filename = name.to_s
213:
214: require 'classes/'+filename.downcase.gsub(/_/, '/')
215:
216: raise filename+' not found!' if ! const_defined?(name)
217:
218: klass = const_get(name)
219: return klass if klass
220: raise klass+" not found!"
221: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.