Class: Torganiser::EpisodeFile
- Inherits:
-
Object
- Object
- Torganiser::EpisodeFile
- Defined in:
- lib/torganiser/episode_file.rb
Overview
Models a file that contains a single episode of a TV series. Attempts to extract episode data, based on the filename.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #basename ⇒ Object
- #episode ⇒ Object
-
#initialize(file) ⇒ EpisodeFile
constructor
A new instance of EpisodeFile.
- #season ⇒ Object
- #series ⇒ Object
Constructor Details
#initialize(file) ⇒ EpisodeFile
Returns a new instance of EpisodeFile.
7 8 9 |
# File 'lib/torganiser/episode_file.rb', line 7 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/torganiser/episode_file.rb', line 5 def file @file end |
Instance Method Details
#basename ⇒ Object
11 12 13 |
# File 'lib/torganiser/episode_file.rb', line 11 def basename @basename ||= File.basename(@file) end |
#episode ⇒ Object
19 20 21 |
# File 'lib/torganiser/episode_file.rb', line 19 def episode @episode ||= episode_info[:episode].to_i end |
#season ⇒ Object
15 16 17 |
# File 'lib/torganiser/episode_file.rb', line 15 def season @season ||= episode_info[:season].to_i end |