Sha256: 98fb3d3add182854dc0f147b25d8485e41fb61ce6600740f6221b2f7da2c4c80

Contents?: true

Size: 624 Bytes

Versions: 5

Compression:

Stored size: 624 Bytes

Contents

module UState
  class Query
    include Beefcake::Message
  
    optional :string, :string, 1

    # Converts a Query or string to a query AST.
    def self.query(q)
      case q
      when String
        parser = QueryStringParser.new
        q = parser.parse(q)
        unless q
          raise ArgumentError, "error parsing #{query_string.inspect} at line #{parser.failure_line}:#{parser.failure_column}: #{parser.failure_reason}"
        end
        q.query
      when Query
        query q.string
      else
        raise ArgumentError, "don't know what to do with #{q.class} #{q.inspect}"
      end
    end
  end 
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ustate-client-0.0.8 lib/ustate/query.rb
ustate-client-0.0.7 lib/ustate/query.rb
ustate-client-0.0.6 lib/ustate/query.rb
ustate-client-0.0.5 lib/ustate/query.rb
ustate-client-0.0.4 lib/ustate/query.rb