Method: ALib::ConfigFile.default=

Defined in:
lib/alib-0.5.1/configfile.rb

.default=(conf) ⇒ Object Also known as: set_default

–}}}



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/alib-0.5.1/configfile.rb', line 35

def default= conf
#--{{{
  if conf.respond_to?('read')
    @default_text = munge conf.read
    @config = YAML::load @default_text
  else
    case conf
      when Hash
        @config = conf
      when Pathname 
        open(conf) do |f| 
          @default_text = munge f.read
          @config = YAML::load @default_text
        end
      when String
        @default_text = munge conf 
        @config = YAML::load @default_text
    end
  end
  @config
#--}}}
end