Class: Leg::Config
- Inherits:
-
Object
- Object
- Leg::Config
- Defined in:
- lib/leg/config.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Config
constructor
A new instance of Config.
- #last_synced_at ⇒ Object
- #load! ⇒ Object
- #synced! ⇒ Object
Constructor Details
#initialize(path) ⇒ Config
Returns a new instance of Config.
5 6 7 |
# File 'lib/leg/config.rb', line 5 def initialize(path) @path = path end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/leg/config.rb', line 3 def end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/leg/config.rb', line 3 def path @path end |
Instance Method Details
#last_synced_at ⇒ Object
15 16 17 |
# File 'lib/leg/config.rb', line 15 def last_synced_at File.mtime(last_synced_path) if File.exist?(last_synced_path) end |
#load! ⇒ Object
9 10 11 12 13 |
# File 'lib/leg/config.rb', line 9 def load! = YAML.load_file(File.join(@path, "leg.yml")) = {} unless .is_a? Hash = symbolize_keys() end |
#synced! ⇒ Object
19 20 21 |
# File 'lib/leg/config.rb', line 19 def synced! FileUtils.touch(last_synced_path) end |