Class: Fuci::CommandCache

Inherits:
Object
  • Object
show all
Defined in:
lib/fuci/command_cache.rb

Constant Summary collapse

CACHE_FILE_LOCATION =
'/tmp/last_fuci_command'

Instance Method Summary collapse

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_commandObject



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

#fetchObject



15
16
17
# File 'lib/fuci/command_cache.rb', line 15

def fetch
  File.read CACHE_FILE_LOCATION
end