Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/lockr/config.rb
Constant Summary collapse
- CONFIG_FILE =
'.lockr'
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lockr/config.rb', line 7 def initialize() @config = nil if File.exists?( CONFIG_FILE) File.open( CONFIG_FILE, 'r') do |f| @config = YAML::load(f) end else filename = File.("~/#{CONFIG_FILE}") if File.exists?( filename) File.open( filename, 'r') do |f| @config = YAML::load(f) end end end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/lockr/config.rb', line 5 def config @config end |