Class: Hanamimastery::CLI::Repositories::Episodes
- Inherits:
-
Object
- Object
- Hanamimastery::CLI::Repositories::Episodes
- Defined in:
- lib/hanamimastery/cli/repositories/episodes.rb
Constant Summary collapse
- REPO_PATH =
'/Users/Sebastian/Projects/hanamimastery/source'
Instance Method Summary collapse
- #exists?(id) ⇒ Boolean
- #fetch(id) ⇒ Object
-
#read(id) ⇒ Object
Reads the episode file content.
-
#replace(id, new_content) ⇒ Object
Replaces the whole file content with the new content.
Instance Method Details
#exists?(id) ⇒ Boolean
30 31 32 |
# File 'lib/hanamimastery/cli/repositories/episodes.rb', line 30 def exists?(id) File.exists?(find(id)) end |
#fetch(id) ⇒ Object
34 35 36 |
# File 'lib/hanamimastery/cli/repositories/episodes.rb', line 34 def fetch(id) Entities::Episode.new(read(id)) end |
#read(id) ⇒ Object
Reads the episode file content
20 21 22 |
# File 'lib/hanamimastery/cli/repositories/episodes.rb', line 20 def read(id) File.read(find(id)) end |
#replace(id, new_content) ⇒ Object
Replaces the whole file content with the new content
26 27 28 |
# File 'lib/hanamimastery/cli/repositories/episodes.rb', line 26 def replace(id, new_content) File.write(find(id), new_content) end |