Class: Wallaby::Mode

Inherits:
Object
  • Object
show all
Defined in:
lib/interfaces/wallaby/mode.rb

Overview

This is the interface that all ORM modes should inherit from and implement.

Direct Known Subclasses

Custom

Class Method Summary collapse

Class Method Details

.default_authorization_providerClass

Returns pagination provider for the mode.

Returns:

  • (Class)

    pagination provider for the mode

See Also:

Since:

  • wallaby-5.2.0



35
36
37
# File 'lib/interfaces/wallaby/mode.rb', line 35

def default_authorization_provider
  check_and_constantize __callee__
end

.model_authorization_providers(classes = ModelAuthorizationProvider.descendants) ⇒ ActiveSupport::HashWithIndifferentAccess<String, Class>

Return a list of authorization providers for authorizer to detect which one to use.

Returns:

  • (ActiveSupport::HashWithIndifferentAccess<String, Class>)

    authorization provider hash

See Also:

Since:

  • wallaby-5.2.0



43
44
45
46
47
48
49
50
51
52
# File 'lib/interfaces/wallaby/mode.rb', line 43

def model_authorization_providers(classes = ModelAuthorizationProvider.descendants)
  # NOTE: make sure default provider always comes last
  @model_authorization_providers ||=
    classes
    .select { |klass| klass.name.include? name }
    .sort_by { |klass| klass.provider_name == DEFAULT_PROVIDER ? 1 : 0 }
    .each_with_object(::ActiveSupport::HashWithIndifferentAccess.new) do |klass, hash|
      hash[klass.provider_name] = klass
    end
end

.model_decoratorClass

Returns model decorator for the mode.

Returns:

  • (Class)

    model decorator for the mode

See Also:



9
10
11
# File 'lib/interfaces/wallaby/mode.rb', line 9

def model_decorator
  check_and_constantize __callee__
end

.model_finderClass

Returns model finder for the mode.

Returns:

  • (Class)

    model finder for the mode

See Also:



15
16
17
# File 'lib/interfaces/wallaby/mode.rb', line 15

def model_finder
  check_and_constantize __callee__
end

.model_pagination_providerClass

Returns pagination provider for the mode.

Returns:

  • (Class)

    pagination provider for the mode

See Also:

Since:

  • wallaby-5.2.0



28
29
30
# File 'lib/interfaces/wallaby/mode.rb', line 28

def model_pagination_provider
  check_and_constantize __callee__
end

.model_service_providerClass

Returns service provider for the mode.

Returns:

  • (Class)

    service provider for the mode

See Also:



21
22
23
# File 'lib/interfaces/wallaby/mode.rb', line 21

def model_service_provider
  check_and_constantize __callee__
end