Class BinaryBlocker::PackedDateTimeEncoder
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 474
474:     def initialize_options(*opts)
475:       super
476:       @opts[:length] = 14
477:     end

[Source]

     # File lib/blocker.rb, line 479
479:     def internal_block(val)
480:       super sprintf("%04d%02d%02d%02d%02d%02d", val.year, val.month, val.mday, val.hour, val.min, val.sec).to_i
481:     end

[Source]

     # File lib/blocker.rb, line 483
483:     def internal_deblock(io)
484:       buffer = io.read(@bytes)
485:       result = buffer.unpack(@format)
486:       year, month, day, hour, min, sec = result.first.unpack("A4A2A2A2A2A2").map { |v| v.to_i }
487:       Time.local(year, month, day, hour, min, sec)
488:     end

[Validate]