Created
August 29, 2014 15:34
-
-
Save laser/41e1d60a1c581fcfc707 to your computer and use it in GitHub Desktop.
Identifying properties of is_prunable?
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
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