Created
January 26, 2016 17:05
-
-
Save zampino/4bd4773bc4cd8fc48d9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def enqueued_resources_for(klass, resource_type: nil) | |
jobs = enqueued_jobs.find_all { |_job| _job[:job] == klass } | |
resources = jobs.map {|job| | |
gid = job[:args].first['_aj_globalid'] | |
gid && GlobalID::Locator.locate(gid) | |
} | |
if resource_type | |
resources = resources.find_all { |resource| resource.is_a?(resource_type) } | |
end | |
resources | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment