Class: Buildbox::Configuration

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/buildbox/configuration.rb

Instance Method Summary collapse

Instance Method Details

#reloadObject



19
20
21
22
23
24
25
# File 'lib/buildbox/configuration.rb', line 19

def reload
  if path.exist?
    read_and_load
  else
    save && read_and_load
  end
end

#saveObject



15
16
17
# File 'lib/buildbox/configuration.rb', line 15

def save
  File.open(path, 'w+') { |file| file.write(pretty_json) }
end

#update(attributes) ⇒ Object



10
11
12
13
# File 'lib/buildbox/configuration.rb', line 10

def update(attributes)
  attributes.each_pair { |key, value| self[key] = value }
  save
end