Module: ConfigFile::ClassMethods

Defined in:
lib/config_file/include.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_fileObject (readonly)

Returns the value of attribute config_file.



3
4
5
# File 'lib/config_file/include.rb', line 3

def config_file
  @config_file
end

Instance Method Details

#__setup_config_methods__Object



13
14
15
16
17
18
19
20
21
# File 'lib/config_file/include.rb', line 13

def __setup_config_methods__
  @config_file.__data__.each do |k,v|
    instance_eval <<-RUBY
    def #{k}
      @config_file.#{k}
    end
    RUBY
  end
end

#config_file_name=(file) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/config_file/include.rb', line 5

def config_file_name=file
  @config_file = ConfigFile.send(file)
  __setup_config_methods__
  @config_file
rescue UnknownConfigFile
  @config_file
end