2011-06-07 06:06:02 -04:00
|
|
|
require 'active_support/concern'
|
|
|
|
|
2010-01-23 12:41:53 -05:00
|
|
|
module Rails
|
|
|
|
class Railtie
|
|
|
|
module Configurable
|
2010-12-19 10:54:30 -05:00
|
|
|
extend ActiveSupport::Concern
|
2010-01-23 12:41:53 -05:00
|
|
|
|
|
|
|
module ClassMethods
|
2012-10-14 06:03:39 -04:00
|
|
|
delegate :config, to: :instance
|
2010-01-23 12:41:53 -05:00
|
|
|
|
|
|
|
def inherited(base)
|
2010-07-19 11:53:14 -04:00
|
|
|
raise "You cannot inherit from a #{self.superclass.name} child"
|
2010-01-23 12:41:53 -05:00
|
|
|
end
|
|
|
|
|
2010-07-19 11:53:14 -04:00
|
|
|
def instance
|
|
|
|
@instance ||= new
|
|
|
|
end
|
|
|
|
|
|
|
|
def respond_to?(*args)
|
|
|
|
super || instance.respond_to?(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def configure(&block)
|
|
|
|
class_eval(&block)
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
2010-12-19 10:58:59 -05:00
|
|
|
def method_missing(*args, &block)
|
|
|
|
instance.send(*args, &block)
|
|
|
|
end
|
2010-01-23 12:41:53 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|