class Sequel::Model

Public Instance Methods

to_hash() click to toggle source
# File lib/egalite/sequel_helper.rb, line 14
def to_hash
  hash = {}
  self.each { |k,v| hash[k] = v }
  hash
end
update_with(hash, *selection) click to toggle source
# File lib/egalite/sequel_helper.rb, line 3
def update_with(hash, *selection)
  data = {}
  selection.flatten.each { |k| data[k] = hash[k] || hash[k.to_sym] }
  update(data)
end
update_without(hash, *selection) click to toggle source
# File lib/egalite/sequel_helper.rb, line 8
def update_without(hash, *selection)
  hash = hash.clone
  selection.flatten.each { |k| hash.delete(k.to_s) if hash.key?(k.to_s) }
  selection.flatten.each { |k| hash.delete(k.to_sym) if hash.key?(k.to_sym) }
  update(hash)
end