Class: Mclone::TaskSet
Direct Known Subclasses
Instance Method Summary collapse
-
#<<(task) ⇒ Object
Add new task or replace existing one with outdated timestamp.
- #resolve(id) ⇒ Object
Methods inherited from ObjectSet
#>>, #[], #commit!, #each, #each_id, #empty?, #eql?, #hash, #id, #initialize, #merge!, #modified?, #object, #size
Constructor Details
This class inherits a constructor from Mclone::ObjectSet
Instance Method Details
#<<(task) ⇒ Object
Add new task or replace existing one with outdated timestamp
345 346 347 348 349 |
# File 'lib/mclone.rb', line 345 def <<(task) t = self[task] super if t.nil? || (!t.nil? && t.mtime < task.mtime) task end |
#resolve(id) ⇒ Object
352 353 354 355 356 357 358 |
# File 'lib/mclone.rb', line 352 def resolve(id) case (ids = super).size when 0 then raise(Task::Error, %(no task matching "#{id}" pattern found)) when 1 then ids.first else raise(Task::Error, %(ambiguous "#{id}" pattern: two or more tasks match)) end end |