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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMapping

Returns a new instance of Mapping.


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 7

def initialize
  @controllers = {
    authorizations: 'doorkeeper/authorizations',
    applications: 'doorkeeper/applications',
    authorized_applications: 'doorkeeper/authorized_applications',
    tokens: 'doorkeeper/tokens',
    token_info: 'doorkeeper/token_info'
  }

  @as = {
    authorizations: :authorization,
    tokens: :token,
    token_info: :token_info
  }

  @skips = []
end

Instance Attribute Details

#asObject

Returns the value of attribute as


5
6
7
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 5

def as
  @as
end

#controllersObject

Returns the value of attribute controllers


5
6
7
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 5

def controllers
  @controllers
end

#skipsObject

Returns the value of attribute skips


5
6
7
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 5

def skips
  @skips
end

Instance Method Details

#[](routes) ⇒ Object


25
26
27
28
29
30
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 25

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

#skipped?(controller) ⇒ Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 32

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