Class: Frizz::Remote
- Inherits:
-
Object
- Object
- Frizz::Remote
- Defined in:
- lib/frizz/remote.rb
Instance Method Summary collapse
- #files ⇒ Object
-
#initialize(bucket_name, ignorance) ⇒ Remote
constructor
A new instance of Remote.
- #upload(file, key) ⇒ Object
Constructor Details
#initialize(bucket_name, ignorance) ⇒ Remote
Returns a new instance of Remote.
6 7 8 9 |
# File 'lib/frizz/remote.rb', line 6 def initialize(bucket_name, ignorance) @bucket_name = bucket_name @ignorance = ignorance end |
Instance Method Details
#files ⇒ Object
11 12 13 |
# File 'lib/frizz/remote.rb', line 11 def files @files ||= bucket.objects.reject { |o| ignore?(o) } end |
#upload(file, key) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/frizz/remote.rb', line 15 def upload(file, key) bucket.objects.build(key).tap do |obj| obj.acl = :public_read obj.content = file obj.content_type = MIME::Types.type_for(key).first.content_type end.save end |