Skip to content

Instantly share code, notes, and snippets.

@Aduciicba
Last active August 29, 2015 14:17
Show Gist options
  • Save Aduciicba/43054f3cbe2707b2b1ad to your computer and use it in GitHub Desktop.
Save Aduciicba/43054f3cbe2707b2b1ad to your computer and use it in GitHub Desktop.
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