Class: Garb::ResultSet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable, Enumerable
Defined in:
lib/garb/result_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results) ⇒ ResultSet

Returns a new instance of ResultSet.



14
15
16
# File 'lib/garb/result_set.rb', line 14

def initialize(results)
  @results = results
end

Instance Attribute Details

#resultsObject

Returns the value of attribute results.



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

def results
  @results
end

#sampledObject Also known as: sampled?

Returns the value of attribute sampled.



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

def sampled
  @sampled
end

#total_resultsObject

Returns the value of attribute total_results.



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

def total_results
  @total_results
end

Instance Method Details

#+(other) ⇒ Object



22
23
24
25
26
# File 'lib/garb/result_set.rb', line 22

def +(other)
  copy = self.dup
  copy.results = @results + other.to_a
  copy
end

#<=>(other) ⇒ Object



18
19
20
# File 'lib/garb/result_set.rb', line 18

def <=>(other)
  results <=> other.results
end

#[](*args) ⇒ Object



28
29
30
31
32
33
# File 'lib/garb/result_set.rb', line 28

def [](*args)
  return @results[*args] if args.size == 1 && args.first.is_a?(Integer)
  copy = self.dup
  copy.results = @results[*args]
  copy
end