blob: c7d0f1fd919d6bdaadab637fe1f38b3a4e2a05fd (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 | module Configurable
  
  module ClassMethods
    def config &blk
      blk ? blk.(configuration) : configuration
    end
    private
    def configuration
      @__configuration__ ||= Rails::Application::Configuration.new
    end
  end
  module InstanceMethods
    private
    def config
      self.class.config
    end
  end
  def self.included(into)
    into.extend ClassMethods
    into.send :include, InstanceMethods
  end
end
 |