Class: IABConsentString::Consent::Range::StartEndRangeEntry
- Inherits:
-
RangeEntry
- Object
- RangeEntry
- IABConsentString::Consent::Range::StartEndRangeEntry
- Defined in:
- lib/iab_consent_string/consent/range/start_end_range_entry.rb
Instance Method Summary collapse
- #appendTo(buffer, currentOffset) ⇒ Object
-
#initialize(startVendorId, endVendorId) ⇒ StartEndRangeEntry
constructor
A new instance of StartEndRangeEntry.
- #size ⇒ Object
- #valid(maxVendorId) ⇒ Object
Constructor Details
#initialize(startVendorId, endVendorId) ⇒ StartEndRangeEntry
Returns a new instance of StartEndRangeEntry.
9 10 11 12 |
# File 'lib/iab_consent_string/consent/range/start_end_range_entry.rb', line 9 def initialize(startVendorId,endVendorId) @startVendorId = startVendorId @endVendorId = endVendorId end |
Instance Method Details
#appendTo(buffer, currentOffset) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# 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 ⇒ Object
14 15 16 17 |
# 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) ⇒ Object
30 31 32 |
# 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 |