Class: Tapas::EpisodeFilter
- Inherits:
-
Object
- Object
- Tapas::EpisodeFilter
- Defined in:
- lib/tapas/episode_filter.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #episodes ⇒ Object
-
#initialize(collection, config) ⇒ EpisodeFilter
constructor
A new instance of EpisodeFilter.
Constructor Details
#initialize(collection, config) ⇒ EpisodeFilter
Returns a new instance of EpisodeFilter.
5 6 7 8 |
# File 'lib/tapas/episode_filter.rb', line 5 def initialize(collection, config) @collection = collection @config = config end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/tapas/episode_filter.rb', line 3 def collection @collection end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/tapas/episode_filter.rb', line 3 def config @config end |
Instance Method Details
#episodes ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tapas/episode_filter.rb', line 10 def episodes return [collection.episodes.sort.last] if config.last return collection.episodes.sort if config.all [ by_number(config.episodes), title(config.title), description(config.description), search(config.search), ].flatten.uniq.sort end |