Module: StatusPageVi::Recordable::RecordableClassMethods
- Defined in:
- lib/status_page_vi/modules/recordable.rb
Instance Method Summary collapse
Instance Method Details
#cache_file_path ⇒ Object
21 22 23 |
# File 'lib/status_page_vi/modules/recordable.rb', line 21 def cache_file_path "#{__dir__}/../../../cache/#{self}.json" end |
#list ⇒ Object
15 16 17 18 19 |
# File 'lib/status_page_vi/modules/recordable.rb', line 15 def list collection.map do |, | self.new(, ) end end |
#save(service) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/status_page_vi/modules/recordable.rb', line 8 def save(service) data = collection.merge(service) update_storage(data) @collection = nil end |
#update_storage(data) ⇒ Object
25 26 27 28 |
# File 'lib/status_page_vi/modules/recordable.rb', line 25 def update_storage(data) File.delete(cache_file_path) if File.exist?(cache_file_path) write_to_service_file(data) end |