Module: Morale::Storage
- Included in:
- ConnectionStore
- Defined in:
- lib/morale/storage.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
Instance Method Summary collapse
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/morale/storage.rb', line 4 def location @location end |
Instance Method Details
#delete ⇒ Object
6 7 8 |
# File 'lib/morale/storage.rb', line 6 def delete FileUtils.rm_f(location) end |
#read ⇒ Object
10 11 12 |
# File 'lib/morale/storage.rb', line 10 def read File.exists?(location) and File.read(location) end |
#write(data) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/morale/storage.rb', line 14 def write(data) FileUtils.mkdir_p(File.dirname(location)) f = File.open(location, 'w') f.puts data f.close end |