Class: FileScheduler::Playlist
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #contents ⇒ Object
- #full_url(path) ⇒ Object
-
#initialize(attributes = {}) ⇒ Playlist
constructor
A new instance of Playlist.
- #lines ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Playlist
Returns a new instance of Playlist.
8 9 10 11 12 13 14 15 |
# File 'lib/file_scheduler/playlist.rb', line 8 def initialize(attributes = {}) if String === attributes attributes = { (attributes.url? ? :url : :content) => attributes } end attributes.each { |k,v| send "#{k}=", v } end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/file_scheduler/playlist.rb', line 6 def content @content end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/file_scheduler/playlist.rb', line 6 def url @url end |
Instance Method Details
#contents ⇒ Object
25 26 27 28 29 |
# File 'lib/file_scheduler/playlist.rb', line 25 def contents lines.collect do |path| FileScheduler::URL.new :path => path, :url => full_url(path) end.delete_if(&:hidden?) end |
#full_url(path) ⇒ Object
31 32 33 |
# File 'lib/file_scheduler/playlist.rb', line 31 def full_url(path) URI.join url, path if url end |
#lines ⇒ Object
21 22 23 |
# File 'lib/file_scheduler/playlist.rb', line 21 def lines @lines ||= content.split end |