lib/vendorificator/config.rb in vendorificator-0.3.0 vs lib/vendorificator/config.rb in vendorificator-0.4.0
- old
+ new
@@ -1,10 +1,11 @@
require 'pathname'
module Vendorificator
class Config
attr_accessor :environment
+ attr_reader :metadata
@defaults = {}
@modules = {}
def self.defaults
@@ -32,10 +33,11 @@
@modules[name.to_sym] = klass
end
def initialize(params = {})
@configuration = self.class.defaults.merge(params)
+ @metadata = {}
end
def read_file(filename)
pathname = Pathname.new(filename).cleanpath.expand_path
@@ -62,9 +64,13 @@
@configuration[key] = value
end
def modules
self.class.modules
+ end
+
+ def annotate key, value
+ @metadata.merge!({key => value})
end
def method_missing(method_symbol, *args, &block)
if modules.keys.include? method_symbol
modules[method_symbol].new(environment, args.delete_at(0).to_s, *args, &block)