Class: AWS::S3::S3Object
- Inherits:
-
Object
- Object
- AWS::S3::S3Object
- Defined in:
- lib/extensions/s3.rb
Overview
Methods extending the S3Object class provided by the aws-s3 gem.
Instance Method Summary collapse
-
#save_to(path) ⇒ Object
Copies the S3 Object to a local directory.
-
#to_class_name ⇒ Object
Returns the class represented by the csv file.
Instance Method Details
#save_to(path) ⇒ Object
Copies the S3 Object to a local directory.
save_to('tmp/file.csv')
15 16 17 18 19 20 21 |
# File 'lib/extensions/s3.rb', line 15 def save_to(path) File.open(path,'w') do |file| S3Object.stream(self.key,self.bucket.name) do |chunk| file.write chunk end end end |
#to_class_name ⇒ Object
Returns the class represented by the csv file.
person.csv => Person
9 10 11 |
# File 'lib/extensions/s3.rb', line 9 def to_class_name self.key.gsub('.csv','').capitalize end |