Class: Interpres::Cache
- Inherits:
-
Object
- Object
- Interpres::Cache
- Defined in:
- lib/interpres/cache.rb
Constant Summary collapse
- CACHE =
'.interpres_cache.json'
Instance Method Summary collapse
- #diff(texts) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #read ⇒ Object
- #write(texts) ⇒ Object
Constructor Details
Instance Method Details
#diff(texts) ⇒ Object
24 25 26 |
# File 'lib/interpres/cache.rb', line 24 def diff(texts) texts - @cached_texts end |
#read ⇒ Object
13 14 15 |
# File 'lib/interpres/cache.rb', line 13 def read @cached_texts end |
#write(texts) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/interpres/cache.rb', line 17 def write(texts) file = File.open(CACHE, 'w') file.write(Oj.dump texts) file.close @cached_texts = texts end |