Sha256: 00e4c152ad18920fc7ccc56e39d27925f66d290da0ae4b3178d5d01c4c3641d0
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require File.dirname(__FILE__) + '/base' module Martin # Martin delegation mixin. Mixing this module into an object causes all # methods to be delegated to the Martin::Application class. Used primarily # at the top-level. # 100% ripped from Sinatra::Delegator module Delegator #:nodoc: def self.delegate(*methods) methods.each do |method_name| eval <<-RUBY, binding, '(__DELEGATE__)', 1 def #{method_name}(*args, &b) ::Martin::Application.send(#{method_name.inspect}, *args, &b) end private #{method_name.inspect} RUBY end end delegate :configure, :command, :error, :run end # This is the class that gets loaded if you just require 'martin' class Application < Base error do |input| puts 'Could not find method ' + input.split.first end end at_exit { Application.run } end include Martin::Delegator
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
martin-0.1.2 | lib/martin/application.rb |
martin-0.1.1 | lib/martin/application.rb |