Class: Miasma::Models::Storage::Files
- Inherits:
-
Types::Collection
- Object
- Types::Collection
- Miasma::Models::Storage::Files
- Defined in:
- lib/miasma/models/storage/files.rb
Overview
Abstract file collection
Instance Attribute Summary (collapse)
-
- (Miasma::Api) api
inherited
from Types::Collection
readonly
Underlying service API.
-
- (Bucket) bucket
readonly
Parent bucket.
Instance Method Summary (collapse)
-
- (File) build(args = {})
New unsaved instance.
-
- (Array<File>) filter(options = {})
Return files matching given filter.
-
- (self) initialize(bucket)
constructor
Create new instance.
-
- (File) model
Collection item class.
Constructor Details
- (self) initialize(bucket)
Create new instance
17 18 19 20 |
# File 'lib/miasma/models/storage/files.rb', line 17 def initialize(bucket) @bucket = bucket super bucket.api end |
Instance Attribute Details
- (Miasma::Api) api (readonly) Originally defined in class Types::Collection
Returns underlying service API
- (Bucket) bucket (readonly)
Returns parent bucket
11 12 13 |
# File 'lib/miasma/models/storage/files.rb', line 11 def bucket @bucket end |
Instance Method Details
- (File) build(args = {})
Returns new unsaved instance
32 33 34 35 36 37 38 39 |
# File 'lib/miasma/models/storage/files.rb', line 32 def build(args={}) instance = self.model.new(bucket) args.each do |m_name, m_value| m_name = "#{m_name}=" instance.send(m_name, m_value) end instance end |
- (Array<File>) filter(options = {})
Return files matching given filter
27 28 29 |
# File 'lib/miasma/models/storage/files.rb', line 27 def filter(={}) super end |
- (File) model
Returns collection item class
42 43 44 |
# File 'lib/miasma/models/storage/files.rb', line 42 def model File end |