Class BinaryBlocker::PackedDateEncoder
In: lib/blocker.rb
Parent: PackedNumberEncoder
GroupEncoder ListOfEncoder Blocker FixedArrayEncoder CountedArrayEncoder Encoder SimpleEncoder BitFieldEncoder OneOfEncoder PackedNumberEncoder PackedDateEncoder PackedDateTimeEncoder FixedStringEncoder FixedUTF16StringEncoder BinaryBlocker Module: BinaryBlocker

Methods

Public Instance methods

[Source]

     # File lib/blocker.rb, line 454
454:     def initialize_options(*opts)
455:       super
456:       @opts[:length] = 8
457:     end

[Source]

     # File lib/blocker.rb, line 459
459:     def internal_block(val)
460:       super val.year * 10000 + val.month * 100 + val.mday
461:     end

[Source]

     # File lib/blocker.rb, line 463
463:     def internal_deblock(io)
464:       buffer = io.read(@bytes)
465:       result = buffer.unpack(@format)
466:       year, month, day = result.first.unpack("A4A2A2").map { |v| v.to_i }
467:       Date.civil(year, month, day)
468:     end

[Validate]