Class: Moviesort::TVShow
- Inherits:
-
Object
- Object
- Moviesort::TVShow
- Defined in:
- lib/moviesort/tv_show.rb
Defined Under Namespace
Classes: Parser
Instance Attribute Summary collapse
-
#episode ⇒ Object
readonly
Returns the value of attribute episode.
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#show ⇒ Object
readonly
Returns the value of attribute show.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename, show, season, episode) ⇒ TVShow
constructor
A new instance of TVShow.
- #target_filename ⇒ Object
- #target_path ⇒ Object
Constructor Details
#initialize(filename, show, season, episode) ⇒ TVShow
Returns a new instance of TVShow.
7 8 9 10 11 12 |
# File 'lib/moviesort/tv_show.rb', line 7 def initialize(filename, show, season, episode) @show = show @season = season @episode = episode @extension = File.extname(filename) end |
Instance Attribute Details
#episode ⇒ Object (readonly)
Returns the value of attribute episode.
5 6 7 |
# File 'lib/moviesort/tv_show.rb', line 5 def episode @episode end |
#season ⇒ Object (readonly)
Returns the value of attribute season.
5 6 7 |
# File 'lib/moviesort/tv_show.rb', line 5 def season @season end |
#show ⇒ Object (readonly)
Returns the value of attribute show.
5 6 7 |
# File 'lib/moviesort/tv_show.rb', line 5 def show @show end |
Class Method Details
Instance Method Details
#target_filename ⇒ Object
25 26 27 |
# File 'lib/moviesort/tv_show.rb', line 25 def target_filename "#{@show.gsub(/\W/, '.')}.S%.2iE%.2i#{@extension}" % [season, episode] end |
#target_path ⇒ Object
21 22 23 |
# File 'lib/moviesort/tv_show.rb', line 21 def target_path Pathname.new(File.join(show, "Season #{season}")) end |