Class: Chef::SolrInstaller::Config::CompatConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/solr/solr_installer.rb

Instance Method Summary collapse

Constructor Details

#initializeCompatConfig

Returns a new instance of CompatConfig.



29
30
31
# File 'lib/chef/solr/solr_installer.rb', line 29

def initialize
  @config_settings = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/chef/solr/solr_installer.rb', line 43

def method_missing(method_name, *args, &block)
  if args.size == 1
    @config_settings[method_name] = args.first
  elsif args.empty?
    @config_settings[method_name] or super
  else
    super
  end
end

Instance Method Details

#from_file(file) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/chef/solr/solr_installer.rb', line 33

def from_file(file)
  file = File.expand_path(file)
  if File.readable?(file)
    instance_eval(IO.read(file), file, 1)
  else
    STDERR.puts "Cannot open config file #{file} default settings will be used"
  end
  self
end

#to_hashObject



53
54
55
# File 'lib/chef/solr/solr_installer.rb', line 53

def to_hash
  @config_settings
end