Class: MR::FakeQuery
- Inherits:
-
Object
- Object
- MR::FakeQuery
- Defined in:
- lib/mr/fake_query.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#count ⇒ Object
(also: #count!)
readonly
Returns the value of attribute count.
-
#results ⇒ Object
(also: #results!)
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #first ⇒ Object (also: #first!)
-
#initialize(results) ⇒ FakeQuery
constructor
A new instance of FakeQuery.
- #paged(page_num = nil, page_size = nil) ⇒ Object
Constructor Details
#initialize(results) ⇒ FakeQuery
Returns a new instance of FakeQuery.
11 12 13 14 |
# File 'lib/mr/fake_query.rb', line 11 def initialize(results) @results = results || [] @count = @results.size end |
Instance Attribute Details
#count ⇒ Object (readonly) Also known as: count!
Returns the value of attribute count.
7 8 9 |
# File 'lib/mr/fake_query.rb', line 7 def count @count end |
#results ⇒ Object (readonly) Also known as: results!
Returns the value of attribute results.
7 8 9 |
# File 'lib/mr/fake_query.rb', line 7 def results @results end |
Instance Method Details
#first ⇒ Object Also known as: first!
16 17 18 |
# File 'lib/mr/fake_query.rb', line 16 def first @results.first end |
#paged(page_num = nil, page_size = nil) ⇒ Object
21 22 23 |
# File 'lib/mr/fake_query.rb', line 21 def paged(page_num = nil, page_size = nil) FakePagedQuery.new(self, page_num, page_size) end |