Class: Humble::ResultSet
- Inherits:
-
Object
- Object
- Humble::ResultSet
- Includes:
- Enumerable
- Defined in:
- lib/humble/result_set.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #include?(item) ⇒ Boolean
-
#initialize(rows, mapper) ⇒ ResultSet
constructor
A new instance of ResultSet.
- #inspect ⇒ Object
Constructor Details
#initialize(rows, mapper) ⇒ ResultSet
Returns a new instance of ResultSet.
5 6 7 8 |
# File 'lib/humble/result_set.rb', line 5 def initialize(rows, mapper) @rows = rows @mapper = mapper end |
Instance Method Details
#each(&block) ⇒ Object
10 11 12 13 14 |
# File 'lib/humble/result_set.rb', line 10 def each(&block) @rows.each do |row| block.call(@mapper.map_from(row)) end end |
#include?(item) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/humble/result_set.rb', line 16 def include?(item) self.find do |x| x == item end end |
#inspect ⇒ Object
22 23 24 |
# File 'lib/humble/result_set.rb', line 22 def inspect "[#{self.map { |x| x.inspect }.join(", ")}]" end |