Class: Lita::Extensions::Confirmation
- Inherits:
-
Object
- Object
- Lita::Extensions::Confirmation
- Defined in:
- lib/lita/extensions/confirmation.rb,
lib/lita/extensions/confirmation/unconfirmed_command.rb
Defined Under Namespace
Classes: UnconfirmedCommand
Instance Attribute Summary collapse
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#robot ⇒ Object
readonly
Returns the value of attribute robot.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(handler, message, robot, route) ⇒ Confirmation
constructor
A new instance of Confirmation.
Constructor Details
#initialize(handler, message, robot, route) ⇒ Confirmation
Returns a new instance of Confirmation.
15 16 17 18 19 20 |
# File 'lib/lita/extensions/confirmation.rb', line 15 def initialize(handler, , robot, route) @handler = handler @message = @robot = robot @route = route end |
Instance Attribute Details
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
4 5 6 |
# File 'lib/lita/extensions/confirmation.rb', line 4 def handler @handler end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/lita/extensions/confirmation.rb', line 4 def @message end |
#robot ⇒ Object (readonly)
Returns the value of attribute robot.
4 5 6 |
# File 'lib/lita/extensions/confirmation.rb', line 4 def robot @robot end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
4 5 6 |
# File 'lib/lita/extensions/confirmation.rb', line 4 def route @route end |
Class Method Details
.call(payload) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/lita/extensions/confirmation.rb', line 6 def self.call(payload) new( payload.fetch(:handler), payload.fetch(:message), payload.fetch(:robot), payload.fetch(:route) ).call end |
Instance Method Details
#call ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lita/extensions/confirmation.rb', line 22 def call if ( = route.extensions[:confirmation]) .reply( I18n.t( "lita.extensions.confirmation.request", code: UnconfirmedCommand.new(handler, , robot, route, ).code ) ) return false end true end |