2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-06 13:15:47 -04:00
|
|
|
require "active_support/concern"
|
2011-06-07 06:06:02 -04:00
|
|
|
|
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)
|
2016-08-07 19:05:28 -04:00
|
|
|
raise "You cannot inherit from a #{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
|
|
|
|
|
2016-12-23 05:20:01 -05:00
|
|
|
private
|
2010-07-19 11:53:14 -04:00
|
|
|
|
2016-08-06 13:55:02 -04:00
|
|
|
def method_missing(*args, &block)
|
|
|
|
instance.send(*args, &block)
|
|
|
|
end
|
2010-01-23 12:41:53 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|