Introduction
Shot Libs is a series of Loaders which allow you to utilize Helpers and Libraries to outsource controller and app logic.
Installation
gem install shot_libs
Usage Example
require 'shot'
require 'shot_libs'
app = Application.new
app.add_loader HelperLoader
app.add_loader LibraryLoader
app.run do
app.on 'load' do |instance|
instance.get 'library', 'SomeLibrary'
end
end
app.start
Controller Example
application/helpers/email.rb
class Email
self.send_email(recipient, subject, body)
end
end
application/controllers/email.rb
require 'shot_mvc'
class EmailController < Controller
def setup
get 'helper', 'Email'
end
def send(message)
Email.send_email message['recipient'], message['subject'], message['body']
end
end