Class: Miasma::Models::Storage::Files

Inherits:
Types::Collection show all
Defined in:
lib/miasma/models/storage/files.rb

Overview

Abstract file collection

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (self) initialize(bucket)

Create new instance

Parameters:

  • bucket (Bucket)

    parent bucket



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

Returns:

  • (Miasma::Api)

    underlying service API

- (Bucket) bucket (readonly)

Returns parent bucket

Returns:



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

Returns:

  • (File)

    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

Parameters:

  • options (Hash) (defaults to: {})

    filter options

Options Hash (options):

  • :prefix (String)

    key prefix

Returns:



27
28
29
# File 'lib/miasma/models/storage/files.rb', line 27

def filter(options={})
  super
end

- (File) model

Returns collection item class

Returns:

  • (File)

    collection item class



42
43
44
# File 'lib/miasma/models/storage/files.rb', line 42

def model
  File
end