Class: Stratify::ITunes::Presenter
- Inherits:
-
Object
- Object
- Stratify::ITunes::Presenter
show all
- Defined in:
- lib/stratify-itunes/presenter.rb
Instance Method Summary
collapse
Constructor Details
#initialize(activity) ⇒ Presenter
Returns a new instance of Presenter.
4
5
6
|
# File 'lib/stratify-itunes/presenter.rb', line 4
def initialize(activity)
@activity = activity
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
36
37
38
|
# File 'lib/stratify-itunes/presenter.rb', line 36
def method_missing(*args)
@activity.send(*args)
end
|
Instance Method Details
#details ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/stratify-itunes/presenter.rb', line 17
def details
if tv_show?
join_fields_with_separator season_number, episode_number, year
else
join_fields_with_separator album, year, genre
end
end
|
#episode_number ⇒ Object
30
31
32
33
34
|
# File 'lib/stratify-itunes/presenter.rb', line 30
def episode_number
number = @activity.episode_number || @activity.track_number
return unless number
"Episode #{number}"
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/stratify-itunes/presenter.rb', line 8
def name
@activity.name.blank? ? 'Untitled' : @activity.name
end
|
#season_number ⇒ Object
25
26
27
28
|
# File 'lib/stratify-itunes/presenter.rb', line 25
def season_number
return unless @activity.season_number
"Season #{@activity.season_number}"
end
|
#summary ⇒ Object
12
13
14
15
|
# File 'lib/stratify-itunes/presenter.rb', line 12
def summary
return name if movie?
join_fields_with_separator name, artist
end
|