Method: DTAS::Mlib#node_update_maybe

Defined in:
lib/dtas/mlib.rb

#node_update_maybe(node, tlen, ctime) ⇒ Object



266
267
268
269
270
271
272
273
274
# File 'lib/dtas/mlib.rb', line 266

def node_update_maybe(node, tlen, ctime)
  q = {}
  q[:ctime] = ctime if ctime && ctime != node[:ctime]
  q[:tlen] = tlen if tlen != node[:tlen]
  return if q.empty?
  node_id = node.delete(:id)
  @db[:nodes].where(id: node_id).update(node.merge(q))
  node[:id] = node_id
end