Class: OData4::Query::Result Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/odata4/query/result.rb,
lib/odata4/query/result/atom.rb,
lib/odata4/query/result/json.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents the results of executing a OData4::Query.

Defined Under Namespace

Modules: Atom, JSON

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, result) ⇒ Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a result with the query and the result.

Parameters:



13
14
15
16
17
# File 'lib/odata4/query/result.rb', line 13

def initialize(query, result)
  @query      = query
  @result     = result
  check_result_type
end

Instance Attribute Details

#queryObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/odata4/query/result.rb', line 8

def query
  @query
end

Instance Method Details

#each(&block) ⇒ OData4::Entity

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Provided for Enumerable functionality

Parameters:

  • block (block)

    a block to evaluate

Returns:



22
23
24
25
26
27
28
29
30
31
# File 'lib/odata4/query/result.rb', line 22

def each(&block)
  unless empty?
    process_results(&block)
    until next_page.nil?
      # ensure query gets executed with the same options
      result = query.execute(next_page_url)
      process_results(&block)
    end
  end
end

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Checks whether the result set contains any results

Returns:

  • (Boolean)


35
36
37
# File 'lib/odata4/query/result.rb', line 35

def empty?
  @empty_result ||= find_entities.empty?
end