Class: Tapas::Episode

Inherits:
Struct
  • Object
show all
Includes:
Comparable
Defined in:
lib/tapas/episode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



2
3
4
# File 'lib/tapas/episode.rb', line 2

def description
  @description
end

#numberObject

Returns the value of attribute number

Returns:

  • (Object)

    the current value of number



2
3
4
# File 'lib/tapas/episode.rb', line 2

def number
  @number
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



2
3
4
# File 'lib/tapas/episode.rb', line 2

def title
  @title
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



2
3
4
# File 'lib/tapas/episode.rb', line 2

def url
  @url
end

Instance Method Details

#<=>(other) ⇒ Object



13
14
15
# File 'lib/tapas/episode.rb', line 13

def <=>(other)
  [number.to_i, title] <=> [other.number.to_i, other.title]
end

#description_matches?(text) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/tapas/episode.rb', line 9

def description_matches?(text)
  description.downcase.include?(text.downcase)
end

#title_matches?(text) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/tapas/episode.rb', line 5

def title_matches?(text)
  title.downcase.include?(text.downcase)
end

#to_sObject



17
18
19
20
21
22
23
# File 'lib/tapas/episode.rb', line 17

def to_s
  if number
    "%3d - %s" % [ number, title ]
  else
    "      %s" % title
  end
end