Class: Believer::EmptyResult
- Inherits:
-
Query
- Object
- Command
- FilterCommand
- Query
- Believer::EmptyResult
- Defined in:
- lib/believer/empty_result.rb
Overview
class EmptyResult
DATA_METHODS = {
:execute => [],
:destroy_all => nil,
:delete_all => 0,
:to_a => [],
:size => 0,
:count => 0,
:each => nil,
:first => nil,
:last => nil,
:any? => false,
:sort_by => nil,
:loaded_objects => []
}
QUERY_METHODS = [:select, :where, :order, :limit]
DATA_METHODS.each do |method_name, return_val|
define_method(method_name) do |*|
return_val
end
end
QUERY_METHODS.each do |method_name|
define_method(method_name) do |*|
self
end
end
end
Constant Summary
Constants inherited from Query
Instance Attribute Summary
Attributes inherited from Query
#filtering_allowed, #limit_to, #order_by, #record_class, #selects
Attributes inherited from Command
#consistency_level, #record_class
Instance Method Summary collapse
- #clone ⇒ Object
- #count ⇒ Object
- #execute(name = nil) ⇒ Object
- #exists?(*args) ⇒ Boolean
- #to_a ⇒ Object
- #to_cql ⇒ Object
Methods inherited from Query
#allow_filtering, #initialize, #limit, #order, #pluck, #query_attributes, #select
Methods included from ActAsEnumerable
#any?, #first, included, #last
Methods included from Purging
#delete_all, #delete_all_chunked, #destroy_all
Methods included from Updating
Methods included from Extending
Methods inherited from FilterCommand
#query_attributes, #where, #wheres, #wheres=
Methods inherited from Command
#can_execute?, #command_name, #consistency, #execution_options, #execution_options=, #initialize, #override_execution_options, #query_attributes
Constructor Details
This class inherits a constructor from Believer::Query
Instance Method Details
#clone ⇒ Object
35 36 37 |
# File 'lib/believer/empty_result.rb', line 35 def clone self end |
#count ⇒ Object
51 52 53 |
# File 'lib/believer/empty_result.rb', line 51 def count 0 end |
#execute(name = nil) ⇒ Object
55 56 57 |
# File 'lib/believer/empty_result.rb', line 55 def execute(name = nil) [] end |
#exists?(*args) ⇒ Boolean
47 48 49 |
# File 'lib/believer/empty_result.rb', line 47 def exists?(*args) false end |
#to_a ⇒ Object
43 44 45 |
# File 'lib/believer/empty_result.rb', line 43 def to_a [] end |
#to_cql ⇒ Object
39 40 41 |
# File 'lib/believer/empty_result.rb', line 39 def to_cql nil end |