Class | BinaryBlocker::PackedNumberEncoder |
In: |
lib/blocker.rb
|
Parent: | SimpleEncoder |
# File lib/blocker.rb, line 426 426: def initialize(*opts) 427: initialize_options(*opts) 428: 429: @length = @opts[:length].to_i 430: raise ArgumentError.new("Missing or invalid string length") unless @length > 0 431: @length += 1 if @length[0] == 1 432: @bytes = @length / 2 433: @format = "H#{@length}" 434: 435: @key = @opts[:key] 436: @valid = @opts[:valid] 437: 438: initialize_data(*opts) 439: end
# File lib/blocker.rb, line 441 441: def internal_block(val) 442: ["%0#{@length}d" % val].pack(@format) 443: end