Class: Command::Cacheable::CachingCommand
- Defined in:
- lib/command/cacheable/caching.rb
Instance Method Summary collapse
- #cache_dir ⇒ Object
- #cache_file ⇒ Object
- #execute ⇒ Object
-
#initialize(*args, debug: false, dir: nil) ⇒ CachingCommand
constructor
caches its input and values.
Constructor Details
#initialize(*args, debug: false, dir: nil) ⇒ CachingCommand
caches its input and values.
11 12 13 14 |
# File 'lib/command/cacheable/caching.rb', line 11 def initialize *args, debug: false, dir: nil @args = args.dup @dir = dir || '/tmp' + Pathname.new($0)..to_s end |
Instance Method Details
#cache_dir ⇒ Object
16 17 18 |
# File 'lib/command/cacheable/caching.rb', line 16 def cache_dir @dir end |
#cache_file ⇒ Object
20 21 22 |
# File 'lib/command/cacheable/caching.rb', line 20 def cache_file CacheFile.new cache_dir, @args end |
#execute ⇒ Object
24 25 26 27 |
# File 'lib/command/cacheable/caching.rb', line 24 def execute cachefile = cache_file @output = cachefile.read end |