Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Created May 17, 2012 21:08
Show Gist options
  • Select an option

  • Save wilmoore/2721603 to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/2721603 to your computer and use it in GitHub Desktop.
Inheritance & Composition playing nice in Ruby
module StorageAgnostic
class FileStore
# common filestore methods
end
class LocalFilesystem < FileStore
# optionally override common filestore methods for special needs
end
class RackspaceCloud < FileStore
include HttpTransport
include AuthHttpBasic
# optionally override common filestore methods for special needs
end
class GoogleDrive < FileStore
include HttpTransport
include AuthOauth
# optionally override common filestore methods for special needs
end
class AmazonS3 < FileStore
include S3FlavoredRestHttpTransport
include AuthCustomHttpHeaders
# optionally override common filestore methods for special needs
end
end
@wilmoore
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment