Class: Hanamimastery::CLI::Repositories::Episodes

Inherits:
Object
  • Object
show all
Defined in:
lib/hanamimastery/cli/repositories/episodes.rb

Constant Summary collapse

REPO_PATH =
'/Users/Sebastian/Projects/hanamimastery/source'

Instance Method Summary collapse

Instance Method Details

#exists?(id) ⇒ Boolean

Returns:

  • (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