Class: Buzzsprout::Episode
- Inherits:
-
Hashie::Dash
- Object
- Hashie::Dash
- Buzzsprout::Episode
- Defined in:
- lib/buzzsprout/episode.rb
Instance Method Summary collapse
-
#duration ⇒ String
Formatted duration.
-
#duration=(value) ⇒ nil
Set the duration.
-
#duration_in_seconds ⇒ Integer
Duration in seconds.
-
#live? ⇒ true, false
Has the episode been published?.
-
#s3? ⇒ true, false
Has the episode been uploaded to S3?.
-
#tags ⇒ Array<String>
List of tags.
Instance Method Details
#duration ⇒ String
Formatted duration
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
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_seconds ⇒ 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?
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?
20 21 22 |
# File 'lib/buzzsprout/episode.rb', line 20 def s3? !!self[:s3] end |
#tags ⇒ Array<String>
List of tags
54 55 56 |
# File 'lib/buzzsprout/episode.rb', line 54 def self[:tags].split(",") end |