Class: WatchedFileRepository
- Inherits:
-
Object
- Object
- WatchedFileRepository
- Defined in:
- lib/text_tunnel/watched_file_repository.rb
Instance Method Summary collapse
- #create(name, data) ⇒ Object
- #find(id) ⇒ Object
-
#initialize ⇒ WatchedFileRepository
constructor
A new instance of WatchedFileRepository.
- #remove(watched_file) ⇒ Object
Constructor Details
#initialize ⇒ WatchedFileRepository
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 |