Method: RC::Config#initialize

Defined in:
lib/rc/config.rb

#initialize(*args, &block) ⇒ Config

Initialize Config instance. Config instances are per-configuration, which means they are associated with one and only one config entry.

Parameters:

  • target (#to_s)

    The command or feature name. (optional)

  • properties (Hash)

    Any additional properties associated with the config entry.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rc/config.rb', line 25

def initialize(*args, &block)
  properties = (Hash === args.last ? args.pop : {})
  target     = args.first

  @property = {:command=>nil, :feature=>nil, :profile=>'default'}

  if target
    @property[:command] = target.to_s
    @property[:feature] = target.to_s
  end

  @block = block

  properties.each do |k, v|
    property(k,v)
  end
end