Sha256: 3a0641c3cf55310ada987a91eaef482aba2103d5fd3580f5fdcb16443256115c
Contents?: true
Size: 498 Bytes
Versions: 10
Compression:
Stored size: 498 Bytes
Contents
module Skype @@filters = {} def self.response_filter(pattern, &block) raise ArgumentError, "pattern must be instance of Regexp" unless pattern.kind_of? Regexp raise ArgumentError, "block not given" unless block_given? @@filters[pattern] = block end def self.filter_response(response_string) @@filters.each do |filter, block| next unless response_string =~ filter response_string = block.call(response_string) break end response_string end end
Version data entries
10 entries across 10 versions & 1 rubygems