Class: Dropsite::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/dropsite/application.rb

Overview

Wraps the main configuration file. Exists mostly in case of future expansion of configuration options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ ConfigFile

Returns a new instance of ConfigFile.



78
79
80
# File 'lib/dropsite/application.rb', line 78

def initialize(path=nil)
  @path = path || File.join(Dropsite.dropsite_config_dir, 'config.yml')
end

Instance Attribute Details

#excludeObject (readonly)

Returns the value of attribute exclude.



76
77
78
# File 'lib/dropsite/application.rb', line 76

def exclude
  @exclude
end

#pathObject (readonly)

Returns the value of attribute path.



76
77
78
# File 'lib/dropsite/application.rb', line 76

def path
  @path
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/dropsite/application.rb', line 89

def exist?
  File.exist? path
end

#readObject



82
83
84
85
86
87
# File 'lib/dropsite/application.rb', line 82

def read
  return if not exist?
  config = YAML::load(IO.read(path))
  @exclude = config['exclude']
  self
end