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.



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

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.



7
8
9
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 7

def as
  @as
end

#controllersObject

Returns the value of attribute controllers.



7
8
9
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 7

def controllers
  @controllers
end

#skipsObject

Returns the value of attribute skips.



7
8
9
# File 'lib/doorkeeper/rails/routes/mapping.rb', line 7

def skips
  @skips
end

Instance Method Details

#[](routes) ⇒ Object



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

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

#skipped?(controller) ⇒ Boolean

Returns:

  • (Boolean)


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

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