AWS/S3 and subclassing

Hi all,

How can I make this class return instances of Page instead of instances
of AWS::S3::S3Object when I call Page.find(“mydomain”, “mypath”)?

require “rubygems”
require “aws/s3”

class Page < AWS::S3::S3Object

class << self

alias_method :s3find, :find

def find(domain, path)
  connect_to_s3
  s3find("#{domain}/#{path}", BUCKET)
end

end
end

I want to be able to define instance methods for updating or deleting a
page.

Grateful for any pointers/suggestions.

Regards

Adam

OK. I’ve realised why this is happening. S3Object.find delegates to
Bucket.find and Bucket.find returns an array of S3Object instances.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs