Class: Addic7ed::ShowList

Inherits:
Object
  • Object
show all
Defined in:
lib/addic7ed/show_list.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_name) ⇒ ShowList

Returns a new instance of ShowList.



5
6
7
# File 'lib/addic7ed/show_list.rb', line 5

def initialize(raw_name)
  @raw_name = raw_name
end

Instance Attribute Details

#raw_nameObject (readonly)

Returns the value of attribute raw_name.



3
4
5
# File 'lib/addic7ed/show_list.rb', line 3

def raw_name
  @raw_name
end

Class Method Details

.url_segment_for(raw_name) ⇒ Object



9
10
11
# File 'lib/addic7ed/show_list.rb', line 9

def self.url_segment_for(raw_name)
  new(raw_name).url_segment_for
end

Instance Method Details

#url_segment_forObject

Raises:

  • (ShowNotFound)


13
14
15
16
17
18
# File 'lib/addic7ed/show_list.rb', line 13

def url_segment_for
  shows_matching = shows_matching_exactly
  shows_matching = shows_matching_without_year if shows_matching.empty?
  raise ShowNotFound if shows_matching.empty?
  shows_matching.last.gsub(' ', '_')
end