Skip to content

Instantly share code, notes, and snippets.

@laser
Created August 29, 2014 15:34
Show Gist options
  • Save laser/41e1d60a1c581fcfc707 to your computer and use it in GitHub Desktop.
Save laser/41e1d60a1c581fcfc707 to your computer and use it in GitHub Desktop.
Identifying properties of is_prunable?
class Prunable
THIRTY_DAYS_AGO_SEC = 60 * 60 * 24 * 30
def self.from_assets(exclusion_time, assets)
assets.select do |asset|
self.is_prunable?(exclusion_time, asset)
end
end
def self.is_prunable?(exclusion_time, asset)
sec_ago = 60 * 60 * 24 * 30 # 30 days
asset.created_at < exclusion_time - sec_ago
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment