Class: WatchedFileRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/text_tunnel/watched_file_repository.rb

Instance Method Summary collapse

Constructor Details

#initializeWatchedFileRepository

Returns a new instance of WatchedFileRepository.



4
5
6
# File 'lib/text_tunnel/watched_file_repository.rb', line 4

def initialize
  @watched_files = {}
end

Instance Method Details

#create(name, data) ⇒ Object



8
9
10
11
# File 'lib/text_tunnel/watched_file_repository.rb', line 8

def create(name, data)
  watched_file = WatchedFile.new(name, data)
  @watched_files[watched_file.id] = watched_file
end

#find(id) ⇒ Object



17
18
19
# File 'lib/text_tunnel/watched_file_repository.rb', line 17

def find(id)
  @watched_files.fetch(id)
end

#remove(watched_file) ⇒ Object



13
14
15
# File 'lib/text_tunnel/watched_file_repository.rb', line 13

def remove(watched_file)
  @watched_files.delete(watched_file.id)
end