Class: Lita::RouteValidator Private
- Inherits:
-
Object
- Object
- Lita::RouteValidator
- Defined in:
- lib/lita/route_validator.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Determines if an incoming message should trigger a route.
Instance Attribute Summary collapse
-
#handler ⇒ Object
readonly
private
The handler class the route belongs to.
-
#message ⇒ Object
readonly
private
The incoming message.
-
#robot ⇒ Object
readonly
private
The currently running robot.
-
#route ⇒ Object
readonly
private
The route being checked.
Instance Method Summary collapse
-
#call ⇒ Boolean
private
Returns a boolean indicating whether or not the route should be triggered.
-
#initialize(handler, route, message, robot) ⇒ RouteValidator
constructor
private
A new instance of RouteValidator.
Constructor Details
#initialize(handler, route, message, robot) ⇒ RouteValidator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RouteValidator.
21 22 23 24 25 26 |
# File 'lib/lita/route_validator.rb', line 21 def initialize(handler, route, , robot) @handler = handler @route = route = @robot = robot end |
Instance Attribute Details
#handler ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The handler class the route belongs to.
6 7 8 |
# File 'lib/lita/route_validator.rb', line 6 def handler @handler end |
#message ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The incoming message.
9 10 11 |
# File 'lib/lita/route_validator.rb', line 9 def end |
#robot ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The currently running robot.
12 13 14 |
# File 'lib/lita/route_validator.rb', line 12 def robot @robot end |
#route ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The route being checked.
15 16 17 |
# File 'lib/lita/route_validator.rb', line 15 def route @route end |
Instance Method Details
#call ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether or not the route should be triggered.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lita/route_validator.rb', line 30 def call return unless command_satisfied?(route, ) return if from_self?(, robot) return unless matches_pattern?(route, ) unless (robot, .user, route.required_groups) robot.trigger( :route_authorization_failed, message: , robot: robot, route: route, ) return end return unless passes_route_hooks?(route, , robot) true end |