Class: Humble::ResultSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/humble/result_set.rb

Instance Method Summary collapse

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

Returns:

  • (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

#inspectObject



22
23
24
# File 'lib/humble/result_set.rb', line 22

def inspect
  "[#{self.map { |x| x.inspect }.join(", ")}]"
end