Class: Leg::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/leg/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/leg/config.rb', line 3

def options
  @options
end

#pathObject (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_atObject



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!
  @options = YAML.load_file(File.join(@path, "leg.yml"))
  @options = {} unless @options.is_a? Hash
  @options = symbolize_keys(@options)
end

#synced!Object



19
20
21
# File 'lib/leg/config.rb', line 19

def synced!
  FileUtils.touch(last_synced_path)
end