Class: MotionAL::AssetsFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/motional/assets_filter.rb

Overview

For filtering assets in the group by asset type.

Constant Summary collapse

DEFAULT_FILTER =

:all means no filter.

:all

Class Method Summary collapse

Class Method Details

.asset_filtersHash

Returns Human readable keys and AssetLibrary Framework constant value.

Returns:

  • (Hash)

    Human readable keys and AssetLibrary Framework constant value.



25
26
27
28
29
30
31
# File 'lib/motional/assets_filter.rb', line 25

def self.asset_filters
  {
    all:   ALAssetsFilter.allAssets,
    photo: ALAssetsFilter.allPhotos,
    video: ALAssetsFilter.allVideos,
  }
end

.reset(group) ⇒ Object

Reset filter. In other words set default filter.

Parameters:



20
21
22
# File 'lib/motional/assets_filter.rb', line 20

def self.reset(group)
  group.al_asset_group.setAssetsFilter(asset_filters[DEFAULT_FILTER])
end

.set(group, filter) ⇒ Object

Note:

Set filter once, it is available permanently until calling ‘reset`.

Set filter.

Parameters:



13
14
15
# File 'lib/motional/assets_filter.rb', line 13

def self.set(group, filter)
  group.al_asset_group.setAssetsFilter(asset_filters[filter.to_sym])
end