class IABConsentString::Consent::Range::StartEndRangeEntry

Public Class Methods

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

Public Instance Methods

appendTo(buffer, currentOffset) click to toggle source
# File lib/iab_consent_string/consent/range/start_end_range_entry.rb, line 19
def appendTo(buffer, currentOffset)
  newOffset = currentOffset
  buffer.setBit(newOffset)
  newOffset += 1
  buffer.setInt(newOffset, IABConsentString::GDPRConstants::VENDOR_ID_SIZE, @startVendorId)
  newOffset += IABConsentString::GDPRConstants::VENDOR_ID_SIZE
  buffer.setInt(newOffset, IABConsentString::GDPRConstants::VENDOR_ID_SIZE, @endVendorId)
  newOffset += IABConsentString::GDPRConstants::VENDOR_ID_SIZE
  newOffset
end
size() click to toggle source
# File lib/iab_consent_string/consent/range/start_end_range_entry.rb, line 14
def size()
  #  One bit for SingleOrRange flag, 2 * VENDOR_ID_SIZE for 2 vendor IDs
  1 + ( IABConsentString::GDPRConstants::VENDOR_ID_SIZE * 2 )
end
valid(maxVendorId) click to toggle source
# File lib/iab_consent_string/consent/range/start_end_range_entry.rb, line 30
def valid(maxVendorId)
  (@startVendorId > 0) && (@endVendorId > 0) && (@startVendorId < @endVendorId) && (@endVendorId <= maxVendorId)
end