Class: FileScheduler::Base
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
-
#root ⇒ Object
Returns the value of attribute root.
-
#status_file ⇒ Object
Returns the value of attribute status_file.
Instance Method Summary collapse
- #after_next(content) ⇒ Object
- #contents ⇒ Object
- #forced_next(time = Time.now) ⇒ Object
-
#initialize(attributes = {}) ⇒ Base
constructor
A new instance of Base.
- #next(time = Time.now) ⇒ Object
- #scheduling(time = Time.now) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Base
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/file_scheduler/base.rb', line 6 def initialize(attributes = {}) case attributes when String attributes = { (attributes.url? ? :playlist : :directory) => attributes } when Pathname attributes = { :directory => attributes } end @root = if attributes.has_key?(:directory) FileScheduler::File.new(attributes[:directory]) elsif attributes.has_key?(:playlist) FileScheduler::Playlist.new(attributes[:playlist]) end end |
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
4 5 6 |
# File 'lib/file_scheduler/base.rb', line 4 def log @log end |
#root ⇒ Object
Returns the value of attribute root.
4 5 6 |
# File 'lib/file_scheduler/base.rb', line 4 def root @root end |
#status_file ⇒ Object
Returns the value of attribute status_file.
4 5 6 |
# File 'lib/file_scheduler/base.rb', line 4 def status_file @status_file end |
Instance Method Details
#after_next(content) ⇒ Object
47 48 49 |
# File 'lib/file_scheduler/base.rb', line 47 def after_next(content) log.save(status_file) if status_file end |
#contents ⇒ Object
29 30 31 |
# File 'lib/file_scheduler/base.rb', line 29 def contents root.contents end |
#forced_next(time = Time.now) ⇒ Object
43 44 45 |
# File 'lib/file_scheduler/base.rb', line 43 def forced_next(time = Time.now) scheduling(time).forced_next end |
#next(time = Time.now) ⇒ Object
39 40 41 |
# File 'lib/file_scheduler/base.rb', line 39 def next(time = Time.now) scheduling(time).next end |
#scheduling(time = Time.now) ⇒ Object
33 34 35 36 37 |
# File 'lib/file_scheduler/base.rb', line 33 def scheduling(time = Time.now) Scheduling.new(root, time).tap do |scheduling| scheduling.log = log end end |