class SequelMapper::Dataset
Attributes
records[R]
Public Class Methods
new(records)
click to toggle source
# File lib/sequel_mapper/dataset.rb, line 3 def initialize(records) @records = records end
Public Instance Methods
each(&block)
click to toggle source
# File lib/sequel_mapper/dataset.rb, line 12 def each(&block) records.each(&block) self end
select(field)
click to toggle source
# File lib/sequel_mapper/dataset.rb, line 27 def select(field) map { |data| data.fetch(field) } end
where(criteria)
click to toggle source
# File lib/sequel_mapper/dataset.rb, line 17 def where(criteria) new( records.select { |row| criteria.all? { |k, v| row.fetch(k, :nope) == v } } ) end
Private Instance Methods
new(records)
click to toggle source
# File lib/sequel_mapper/dataset.rb, line 33 def new(records) self.class.new(records) end