Class: Rounders::Handlers::Handler
- Inherits:
-
Object
- Object
- Rounders::Handlers::Handler
- Includes:
- Plugins::Pluggable
- Defined in:
- lib/rounders/handlers/handler.rb
Defined Under Namespace
Classes: Dispatcher
Instance Attribute Summary collapse
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
-
#rounder ⇒ Object
readonly
Returns the value of attribute rounder.
Class Method Summary collapse
- .dispatch(rounder, mails) ⇒ Object
- .inherited(child_class) ⇒ Object
- .on(option, method_name) ⇒ Object
Instance Method Summary collapse
-
#initialize(rounder, matches) ⇒ Handler
constructor
A new instance of Handler.
Methods included from Plugins::Pluggable
Constructor Details
#initialize(rounder, matches) ⇒ Handler
Returns a new instance of Handler.
43 44 45 46 |
# File 'lib/rounders/handlers/handler.rb', line 43 def initialize(rounder, matches) @rounder = rounder @matches = matches end |
Instance Attribute Details
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
5 6 7 |
# File 'lib/rounders/handlers/handler.rb', line 5 def matches @matches end |
#rounder ⇒ Object (readonly)
Returns the value of attribute rounder.
5 6 7 |
# File 'lib/rounders/handlers/handler.rb', line 5 def rounder @rounder end |
Class Method Details
.dispatch(rounder, mails) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/rounders/handlers/handler.rb', line 21 def dispatch(rounder, mails) mails.map do |mail| dispatchers.each do |dispatcher| matches = dispatcher.matcher.match(mail) next if matches.nil? new(rounder, matches).public_send(dispatcher.method_name, mail) end end end |