Sha256: 48b0fedef388588f414ce3d73376d02f1c3bcb910547382a316d3aa0f3a8b974

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 Bytes

Contents

# @implements automerge.org/automerge-repo/interfaces/_automerge_automerge_repo.StorageAdapterInterface
module ActionMerge
	module StorageAdapter
  	def load(key)
			ActionMerge::Document::Chunk.find(key)
  	end
	
  	def loadRange(key)
			document_id, type = *key
		
			d = ActionMerge::Document.find(document_id)
		
			if type
	  		d.chunks.where(type:)
			else
	  		d.chunks
			end
  	end
  	
  	def remove(key)
			ActionMerge::Document::Chunk.destroy(key)
  	end
  	
  	def removeRange(key)
			loadRange(key).destroy_all
  	end
  	
  	def save(key, value)
			ActionMerge::Document::Chunk.upsert(key, value)
  	end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action_merge-0.1.0 app/models/action_merge/storage_adapter.rb