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
-
#bucket ⇒ Bucket
readonly
Parent bucket.
Attributes inherited from Types::Collection
Instance Method Summary collapse
-
#build(args = {}) ⇒ File
New unsaved instance.
-
#filter(options = {}) ⇒ Array<File>
Return files matching given filter.
-
#initialize(bucket) ⇒ self
constructor
Create new instance.
-
#model ⇒ File
Collection item class.
Methods inherited from Types::Collection
#all, #from_json, #get, #reload, #to_json
Methods included from Utils::Memoization
#_memo, #clear_memoizations!, #memoize, #unmemoize
Constructor Details
#initialize(bucket) ⇒ self
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
#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
#build(args = {}) ⇒ File
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 |
#filter(options = {}) ⇒ Array<File>
Return files matching given filter
27 28 29 |
# File 'lib/miasma/models/storage/files.rb', line 27 def filter(={}) raise NotImplementedError end |