Class: Junkie::Episode

Inherits:
Object
  • Object
show all
Defined in:
lib/junkie/episode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(series, links, description = nil) ⇒ Episode

Returns a new instance of Episode.



11
12
13
14
15
16
17
18
19
# File 'lib/junkie/episode.rb', line 11

def initialize(series, links, description=nil)
  @uuid = SecureRandom.uuid
  @series = series
  @links = links
  @found_at = DateTime.now
  @description = description
  @status = :found
  @id = episode_identifier
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#found_atObject (readonly)

Returns the value of attribute found_at.



8
9
10
# File 'lib/junkie/episode.rb', line 8

def found_at
  @found_at
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/junkie/episode.rb', line 8

def id
  @id
end

Returns the value of attribute links.



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

def links
  @links
end

#pidObject

Returns the value of attribute pid.



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

def pid
  @pid
end

#seriesObject (readonly)

Returns the value of attribute series.



8
9
10
# File 'lib/junkie/episode.rb', line 8

def series
  @series
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#uuidObject (readonly)

Returns the value of attribute uuid.



8
9
10
# File 'lib/junkie/episode.rb', line 8

def uuid
  @uuid
end

Instance Method Details

#to_hashObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/junkie/episode.rb', line 25

def to_hash
  {
      uuid: @uuid,
      id: @id,
      series: @series,
      links: @links,
      status: @status,
      found_at: @found_at,
      description: @description
  }
end

#to_sObject



21
22
23
# File 'lib/junkie/episode.rb', line 21

def to_s
  "%s (%s)" % [ @series, episode_identifier ]
end