Last active
August 29, 2015 14:17
-
-
Save Aduciicba/43054f3cbe2707b2b1ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
class Configg | |
attr_reader :config_paths | |
def initialize | |
@config_paths = [] | |
end | |
def add_paths(*paths) | |
@config_paths += paths.map { |p| File.expand_path(p) } | |
end | |
def save! | |
@config_paths.each do |path| | |
File.new(path, 'w') | |
p 'Here the save method!' | |
end | |
end | |
end | |
class ConfigDelegator < SimpleDelegator | |
def files(*paths) | |
p add_paths(*paths) | |
end | |
end | |
conf = Configg.new | |
delegator = ConfigDelegator.new(conf) | |
delegator.files 'db.conf', 'mail.conf', 'app.conf.open.super.key.storages.lol' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment