Class: Dbhero::RouterConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/dbhero/router_constraint.rb

Constant Summary collapse

@@routes =
Dbhero::Engine.routes

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, options) ⇒ RouterConstraint

Returns a new instance of RouterConstraint.



10
11
12
13
14
15
16
# File 'lib/dbhero/router_constraint.rb', line 10

def initialize(request, options)
  @request = request
  @options = options
  @devise_mapping = options[:devise_mapping] || :user
  @devise_auth = options[:devise_auth] || false
  @enable_public_clip = options[:enable_public_clip] || false
end

Class Method Details

.matches?(request, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/dbhero/router_constraint.rb', line 5

def self.matches? request, options = {}
  _ = new(request, options)
  _.match?
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/dbhero/router_constraint.rb', line 18

def match?
  return ((@enable_public_clip && check_if_is_public_dataclip) ||
          (@devise_auth && authenticate_warden && check_custom_condition))
end