Class: Garb::ResultSet
- Inherits:
-
Object
- Object
- Garb::ResultSet
- Extended by:
- Forwardable
- Includes:
- Comparable, Enumerable
- Defined in:
- lib/garb/result_set.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
-
#sampled ⇒ Object
(also: #sampled?)
Returns the value of attribute sampled.
-
#total_results ⇒ Object
Returns the value of attribute total_results.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #<=>(other) ⇒ Object
- #[](*args) ⇒ Object
-
#initialize(results) ⇒ ResultSet
constructor
A new instance of ResultSet.
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
#results ⇒ Object
Returns the value of attribute results.
9 10 11 |
# File 'lib/garb/result_set.rb', line 9 def results @results end |
#sampled ⇒ Object 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_results ⇒ Object
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 |