Method: Pcut::Query.parse

Defined in:
lib/pcut/query.rb

.parse(str) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/pcut/query.rb', line 24

def self.parse(str)
  unless str.is_a?(String)
    raise ArgumentError, "#{str.to_s} is not a string"
  end
  unless str =~ FORMAT
    raise ArgumentError, "invalid format: #{str}"
  end
  index = Pcut::RangeIndex.parse($2)
  self.new($1, index)
end