Sha256: 55096c19d20a5730db7292cdc2d3da55aa9807317adbd9f2a02b8a6236d3b1c6
Contents?: true
Size: 660 Bytes
Versions: 1
Compression:
Stored size: 660 Bytes
Contents
module CollectionAdapters class ArraySequel def initialize model:, column: @model = model @col = column.to_sym end def << val @model.new.set(@col => val).save rescue Sequel::UniqueConstraintViolation nil end def count @model.count end def concat other other.each {|v| self << v } end def include? key @model[@col => key] != nil end def shift @model.db.transaction do if ob = @model.for_update.first v = ob.values[@col] return v if ob.delete raise Sequel::rollback end end nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
collectionadapters-0.2.0 | lib/collectionadapters/array_sequel.rb |