diff options
| author | Robert | 2017-07-23 22:56:12 +0200 |
|---|---|---|
| committer | Robert | 2017-07-25 21:31:51 +0200 |
| commit | fe46c7832fa1e0c6af450f0937aea3534c0f6b01 (patch) | |
| tree | 60670a6ac730a081c3627f25a44c0bd78ea90d3a /app/concerns | |
| parent | 384a06676b8e0985f39fbc894a2d7dd458823529 (diff) | |
| download | chouette-core-fe46c7832fa1e0c6af450f0937aea3534c0f6b01.tar.bz2 | |
Refs: #3507;20h Specing and Implementing the ZipService
Diffstat (limited to 'app/concerns')
| -rw-r--r-- | app/concerns/configurable.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/concerns/configurable.rb b/app/concerns/configurable.rb new file mode 100644 index 000000000..c7d0f1fd9 --- /dev/null +++ b/app/concerns/configurable.rb @@ -0,0 +1,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 |
