Class: Fuci::CommandCache
- Inherits:
-
Object
- Object
- Fuci::CommandCache
- Defined in:
- lib/fuci/command_cache.rb
Constant Summary collapse
- CACHE_FILE_LOCATION =
'/tmp/last_fuci_command'
Instance Method Summary collapse
- #cache_command ⇒ Object
- #fetch ⇒ Object
-
#initialize(command = nil) ⇒ CommandCache
constructor
A new instance of CommandCache.
Constructor Details
#initialize(command = nil) ⇒ CommandCache
Returns a new instance of CommandCache.
5 6 7 |
# File 'lib/fuci/command_cache.rb', line 5 def initialize command=nil @command = command end |
Instance Method Details
#cache_command ⇒ Object
9 10 11 12 13 |
# File 'lib/fuci/command_cache.rb', line 9 def cache_command file = File.new CACHE_FILE_LOCATION, 'w+' file.write @command file.close end |
#fetch ⇒ Object
15 16 17 |
# File 'lib/fuci/command_cache.rb', line 15 def fetch File.read CACHE_FILE_LOCATION end |