Method: Cuboid::Utilities#regexp_array_match

Defined in:
lib/cuboid/utilities.rb

#regexp_array_match(regexps, str) ⇒ Object



127
128
129
130
131
132
133
134
135
# File 'lib/cuboid/utilities.rb', line 127

def regexp_array_match( regexps, str )
    regexps = [regexps].flatten.compact.
        map { |s| s.is_a?( Regexp ) ? s : Regexp.new( s.to_s ) }
    return true if regexps.empty?

    cnt = 0
    regexps.each { |filter| cnt += 1 if filter.match? str }
    cnt == regexps.size
end