Class: Bowline::AppConfig
- Includes:
- SuperModel::Marshal::Model
- Defined in:
- lib/bowline/app_config.rb
Class Method Summary collapse
- .instance ⇒ Object
- .load!(path) ⇒ Object
- .marshal_records ⇒ Object
- .marshal_records=(record) ⇒ Object
- .reset! ⇒ Object (also: destroy_all, delete_all)
Instance Method Summary collapse
Class Method Details
.instance ⇒ Object
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_records ⇒ Object
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 |