Class: Configy::ConfigFile
- Inherits:
-
Object
- Object
- Configy::ConfigFile
- Defined in:
- lib/configy/config_file.rb
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(path, section) ⇒ ConfigFile
constructor
A new instance of ConfigFile.
- #load_file ⇒ Object
- #mtime ⇒ Object
Constructor Details
#initialize(path, section) ⇒ ConfigFile
Returns a new instance of ConfigFile.
7 8 9 10 |
# File 'lib/configy/config_file.rb', line 7 def initialize(path, section) @path = Pathname.new(path) @section = section end |
Instance Method Details
#config ⇒ Object
12 13 14 |
# File 'lib/configy/config_file.rb', line 12 def config ConfigStore.new(load_file).compile(@section) end |
#load_file ⇒ Object
16 17 18 19 20 |
# File 'lib/configy/config_file.rb', line 16 def load_file YAML::load( ERB.new(@path.read).result ) rescue Errno::ENOENT {} end |
#mtime ⇒ Object
22 23 24 25 26 |
# File 'lib/configy/config_file.rb', line 22 def mtime @path.mtime rescue Errno::ENOENT Time.at(0) end |