Module: ArchUnit::Common::Pattern
- Defined in:
- lib/archunit/common/pattern.rb
Overview
Compiles user-facing glob strings into the regular expressions used by the kernel.
Class Method Summary collapse
Class Method Details
.compile(pattern) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/archunit/common/pattern.rb', line 9 def compile(pattern) case pattern when String compile_glob(pattern.tr('\\', '/')) when Regexp pattern.dup.freeze else raise ArgumentError, 'pattern must be a String glob or Regexp' end end |
.valid?(pattern) ⇒ Boolean
20 21 22 |
# File 'lib/archunit/common/pattern.rb', line 20 def valid?(pattern) pattern.is_a?(String) || pattern.is_a?(Regexp) end |