Class: Doorkeeper::DeviceAuthorizationGrant::Rails::Routes::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb

Overview

rubocop:disable Style/Documentation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMapping

Returns a new instance of Mapping.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb', line 17

def initialize
  @controllers = {
    device_authorizations: 'doorkeeper/device_authorization_grant/device_authorizations',
    device_codes: 'doorkeeper/device_authorization_grant/device_codes'
  }

  @as = {
    device_authorizations: :device_authorizations,
    device_codes: :device_codes
  }

  @skips = []
end

Instance Attribute Details

#asHash{Symbol => Symbol}

Returns:

  • (Hash{Symbol => Symbol})


12
13
14
# File 'lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb', line 12

def as
  @as
end

#controllersHash{Symbol => String}

Returns:

  • (Hash{Symbol => String})


9
10
11
# File 'lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb', line 9

def controllers
  @controllers
end

#skipsArray<Symbol>

Returns:

  • (Array<Symbol>)


15
16
17
# File 'lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb', line 15

def skips
  @skips
end

Instance Method Details

#[](routes) ⇒ Hash

Parameters:

  • routes (Symbol)

Returns:

  • (Hash)


33
34
35
36
37
38
# File 'lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb', line 33

def [](routes)
  {
    controller: @controllers[routes],
    as: @as[routes]
  }
end

#skipped?(controller) ⇒ Boolean

Parameters:

  • controller (Symbol)

Returns:

  • (Boolean)


42
43
44
# File 'lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb', line 42

def skipped?(controller)
  @skips.include?(controller)
end