Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #3 from pressednet/updates_boone
Browse files Browse the repository at this point in the history
Improve object version processing.
  • Loading branch information
itspriddle authored Feb 1, 2017
2 parents 5481f0a + 38b622a commit f9a5039
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Pressed.net
Copyright (c) 2016-2017 Pressed.net

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 5 additions & 8 deletions lib/outatime/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def object_versions
s3_client.list_object_versions(bucket: @options[:bucket],
prefix: @options[:prefix]).each do |response|

versions += filter_future_items(response.versions, @from)
delete_markers += filter_future_items(response.delete_markers, @from)
versions.concat(filter_future_items(response.versions))
delete_markers.concat(filter_future_items(response.delete_markers))
end

# keep only the latest versions
Expand Down Expand Up @@ -127,16 +127,13 @@ def s3_client
@s3_client ||= Aws::S3::Client.new(region: region)
end

# Private: Returns an Array of items modified on or before the given date/time.
# Private: Returns an Array of items modified on or before the @from date/time.
#
# items - An Array of objects. Object must respond to #last_modified.
# date_time - Comparison date/time.
#
# Returns Array.
def filter_future_items(items, date_time)
items.find_all do |obj|
obj.last_modified <= @from
end
def filter_future_items(items)
items.keep_if { |obj| obj.last_modified <= @from }
end
end
end
2 changes: 1 addition & 1 deletion lib/outatime/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Outatime
VERSION = "0.2.0"
VERSION = "0.2.1"
end

0 comments on commit f9a5039

Please sign in to comment.