Class: CQL::Query
Overview
Not a part of the public API. Subject to change at any time.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
the root object that will be queried.
-
#what ⇒ Object
readonly
the root object that will be queried.
Instance Method Summary collapse
-
#initialize(directory, &block) ⇒ Query
constructor
Creates a new query object.
Methods included from Dsl
#as, #eq, #from, #gt, #gte, #lc, #line, #lt, #lte, #method_missing, #name, #sc, #select, #soc, #ssoc, #tags, #tc, #transform, #with, #without
Constructor Details
#initialize(directory, &block) ⇒ Query
Creates a new query object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cql/query.rb', line 14 def initialize(directory, &block) # Set root object @data = directory # Populate configurables from DSL block self.instance_eval(&block) raise(ArgumentError, "A query must specify a 'select' clause") unless @what raise(ArgumentError, "A query must specify a 'from' clause") unless @from warn("Multiple selections made without using an 'as' clause") unless @name_transforms || (@what.count == @what.uniq.count) # Gather relevant objects from root object and filters @data = CQL::MapReduce.gather_objects(@data, @from, @filters) # Extract properties from gathered objects @data = format_output(@data) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CQL::Dsl
Instance Attribute Details
#data ⇒ Object (readonly)
the root object that will be queried
9 10 11 |
# File 'lib/cql/query.rb', line 9 def data @data end |
#what ⇒ Object (readonly)
the root object that will be queried
9 10 11 |
# File 'lib/cql/query.rb', line 9 def what @what end |