Sha256: ad8043662f67e913d0adeb3ab9d68fc98bcddb2382a0e4cde19dba51f8225e5e

Contents?: true

Size: 581 Bytes

Versions: 6

Compression:

Stored size: 581 Bytes

Contents

module CQL

  # A mix-in module containing methods used by objects that want to be able to run queries against objects (often themselves).

  module Queriable

    # The object against which the query will be run.
    attr_accessor :query_root # todo - deprecate this such that queries are always performed against *self*


    # Performs a query against the current *query_root*
    def query(&block)
      raise(ArgumentError, 'Query cannot be run. No query root has been set.') unless @query_root

      Query.new(@query_root, &block).data
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cql-1.7.0 lib/cql/queriable.rb
cql-1.6.0 lib/cql/queriable.rb
cql-1.5.1 lib/cql/queriable.rb
cql-1.5.0 lib/cql/queriable.rb
cql-1.4.2 lib/cql/queriable.rb
cql-1.4.1 lib/cql/queriable.rb