Class: Buzzsprout::Episode

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/buzzsprout/episode.rb

Instance Method Summary collapse

Instance Method Details

#durationString

Formatted duration

Returns:

  • (String)

    duration formatted as time



32
33
34
35
36
# File 'lib/buzzsprout/episode.rb', line 32

def duration
  segments = [self[:duration]/60]
  segments << (self[:duration] % 60 )
  segments.map {|t| t.to_s.rjust(2, '0')}.join(':')
end

#duration=(value) ⇒ nil

Set the duration

Parameters:

  • duration (String)

    as time



40
41
42
43
44
# File 'lib/buzzsprout/episode.rb', line 40

def duration=(value)
  new_duration = value.to_s.split(":").reverse
  s, m = new_duration
  self[:duration] = (s.to_i + (m.to_i*60))
end

#duration_in_secondsInteger

Duration in seconds

Returns:

  • (Integer)

    duration in seconds



48
49
50
# File 'lib/buzzsprout/episode.rb', line 48

def duration_in_seconds
  self[:duration]
end

#live?true, false

Has the episode been published?

Returns:

  • (true, false)

    Boolean indicating whether or not the episode has been published



26
27
28
# File 'lib/buzzsprout/episode.rb', line 26

def live?
  !!self[:live]
end

#s3?true, false

Has the episode been uploaded to S3?

Returns:

  • (true, false)

    Boolean indicating whether or not the episode is on S3



20
21
22
# File 'lib/buzzsprout/episode.rb', line 20

def s3?
  !!self[:s3]
end

#tagsArray<String>

List of tags

Returns:

  • (Array<String>)

    array of tags for this episode



54
55
56
# File 'lib/buzzsprout/episode.rb', line 54

def tags
  self[:tags].split(",")
end