Class: SiriSays::Plugins
- Inherits:
-
Object
- Object
- SiriSays::Plugins
- Defined in:
- lib/siri_says.rb
Class Method Summary collapse
Class Method Details
.add(regex, block) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/siri_says.rb', line 15 def add( regex, block ) (@plugins ||= []) << { regex: regex, block: block } end |
.handle(message) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/siri_says.rb', line 22 def handle( ) (@plugins || []).each do |plugin| if =~ plugin[:regex] plugin[:block].call( ) end end end |