Sha256: 457318a1140a6f05be98c9b21f266da0987756c3322058918a4809ed5e7a5758
Contents?: true
Size: 916 Bytes
Versions: 12
Compression:
Stored size: 916 Bytes
Contents
module Riak module Crdt # The {InnerFlag} is a boolean member of a {Map}. Since flag operations are # extremely simple, this object simply provides internal API methods for # {TypedCollection} to use. # # @api private class InnerFlag def self.new(parent, value = false) ensure_boolean value return value end def self.update(value) ensure_boolean value Operation::Update.new.tap do |op| op.value = value op.type = :flag end end def self.delete Operation::Delete.new.tap do |op| op.type = :flag end end private def self.ensure_boolean(value) return if value.is_a? TrueClass return if value.is_a? FalseClass raise FlagError, t('crdt.flag.not_boolean') end class FlagError < ArgumentError end end end end
Version data entries
12 entries across 12 versions & 2 rubygems