Method: Cinch::Pattern.generate

Defined in:
lib/cinch/pattern.rb

.generate(type, argument) ⇒ Object

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.

Since:

  • 1.1.0



35
36
37
38
39
40
41
42
# File 'lib/cinch/pattern.rb', line 35

def self.generate(type, argument)
  case type
  when :ctcp
    Pattern.new(/^/, /#{Regexp.escape(argument.to_s)}(?:$| .+)/, nil)
  else
    raise ArgumentError, "Unsupported type: #{type.inspect}"
  end
end