Method: Cinch::Plugin::ClassMethods#match
- Defined in:
- lib/cinch/plugin.rb
#match(pattern, options = {}) ⇒ Matcher
TODO:
Document match/listener grouping
Set a match pattern.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/cinch/plugin.rb', line 195 def match(pattern, = {}) = { :use_prefix => true, :use_suffix => true, :method => :execute, :group => nil, :prefix => nil, :suffix => nil, :react_on => nil, :strip_colors => false, }.merge() if [:react_on] [:react_on] = [:react_on].to_s.to_sym end matcher = Matcher.new(pattern, *.values_at(:use_prefix, :use_suffix, :method, :group, :prefix, :suffix, :react_on, :strip_colors)) @matchers << matcher matcher end |