Sha256: 8eb7421eea472e70f5f30327cbf2a13537a89ef2c7221180b56dc45773002886
Contents?: true
Size: 924 Bytes
Versions: 4
Compression:
Stored size: 924 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) 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
4 entries across 4 versions & 1 rubygems