Method: Hx::Path.parse_pattern

Defined in:
lib/hx/path.rb

.parse_pattern(pattern_string) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/hx/path.rb', line 85

def self.parse_pattern(pattern_string)
  tokens = []
  pattern_string.scan(/(\*\*?|[^*]+)/) do |token,|
    tokens << case token
              when "**"; :doublestar
              when "*"; :star
              else; token
              end
  end
  Pattern.new(tokens)
end