Class: AgnosticBackend::Queryable::ResultSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/agnostic_backend/queryable/result_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_results, query) ⇒ ResultSet

Returns a new instance of ResultSet.



9
10
11
# File 'lib/agnostic_backend/queryable/result_set.rb', line 9

def initialize(raw_results, query)
  @raw_results, @query = raw_results, query
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



7
8
9
# File 'lib/agnostic_backend/queryable/result_set.rb', line 7

def query
  @query
end

#raw_resultsObject (readonly)

Returns the value of attribute raw_results.



7
8
9
# File 'lib/agnostic_backend/queryable/result_set.rb', line 7

def raw_results
  @raw_results
end

Instance Method Details

#each(&block) ⇒ Object



13
14
15
16
17
# File 'lib/agnostic_backend/queryable/result_set.rb', line 13

def each(&block)
  filtered_results.each do |result|
    block.call(transform(result))
  end
end

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/agnostic_backend/queryable/result_set.rb', line 19

def empty?
  none?
end

#offsetObject

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/agnostic_backend/queryable/result_set.rb', line 27

def offset
  raise NotImplementedError
end

#total_countObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/agnostic_backend/queryable/result_set.rb', line 23

def total_count
  raise NotImplementedError
end