Module: CQL::Queriable
- Included in:
- Repository, CukeModeler::Model
- Defined in:
- lib/cql/queriable.rb
Overview
A mix-in module containing methods used by objects that want to be able to run queries against objects (often themselves).
Instance Attribute Summary collapse
-
#query_root ⇒ Object
The object against which the query will be run.
Instance Method Summary collapse
-
#query(&block) ⇒ Object
Performs a query against the current query_root.
Instance Attribute Details
#query_root ⇒ Object
The object against which the query will be run.
8 9 10 |
# File 'lib/cql/queriable.rb', line 8 def query_root @query_root end |
Instance Method Details
#query(&block) ⇒ Object
Performs a query against the current query_root
12 13 14 15 16 |
# File 'lib/cql/queriable.rb', line 12 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 |