class IABConsentString::Consent::Range::SingleRangeEntry

Public Class Methods

new(singleVendorId) click to toggle source
# File lib/iab_consent_string/consent/range/single_range_entry.rb, line 9
def initialize(singleVendorId)
  @singleVendorId = singleVendorId
end

Public Instance Methods

appendTo(buffer, currentOffset) click to toggle source
# File lib/iab_consent_string/consent/range/single_range_entry.rb, line 18
def appendTo(buffer, currentOffset)
  newOffset = currentOffset
  buffer.unsetBit(newOffset)
  newOffset += 1
  buffer.setInt(newOffset, IABConsentString::GDPRConstants::VENDOR_ID_SIZE, @singleVendorId)
  newOffset += IABConsentString::GDPRConstants::VENDOR_ID_SIZE
  newOffset
end
size() click to toggle source
# File lib/iab_consent_string/consent/range/single_range_entry.rb, line 13
def size()
  #  One bit for SingleOrRange flag, VENDOR_ID_SIZE for single vendor ID
  1 + IABConsentString::GDPRConstants::VENDOR_ID_SIZE
end
valid(maxVendorId) click to toggle source
# File lib/iab_consent_string/consent/range/single_range_entry.rb, line 27
def valid(maxVendorId)
  (@singleVendorId > 0) && (@singleVendorId <= maxVendorId)
end