Class: Bowline::AppConfig

Inherits:
SuperModel::Base
  • Object
show all
Includes:
SuperModel::Marshal::Model
Defined in:
lib/bowline/app_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



8
9
10
# File 'lib/bowline/app_config.rb', line 8

def instance
  @instance ||= create
end

.load!(path) ⇒ Object



21
22
23
24
# File 'lib/bowline/app_config.rb', line 21

def load!(path)
  self.instance.load_path(path)
  self.instance
end

.marshal_recordsObject



17
18
19
# File 'lib/bowline/app_config.rb', line 17

def marshal_records
  self.instance
end

.marshal_records=(record) ⇒ Object



12
13
14
15
# File 'lib/bowline/app_config.rb', line 12

def marshal_records=(record)
  self.instance.load(record.attributes) if record
  self.instance
end

.reset!Object Also known as: destroy_all, delete_all



26
27
28
# File 'lib/bowline/app_config.rb', line 26

def reset!
  @instance = nil
end

Instance Method Details

#load_path(path) ⇒ Object



33
34
35
36
# File 'lib/bowline/app_config.rb', line 33

def load_path(path)
  return unless path && File.exist?(path)
  load(YAML::load(File.read(path)))
end