Class | BinaryBlocker::OneOfEncoder |
In: |
lib/blocker.rb
|
Parent: | Encoder |
# File lib/blocker.rb, line 500 500: def initialize(classes, *opts) 501: @classes = classes.map { |o| o.call(*opts) } 502: @obj = nil 503: super(*opts) 504: end
# File lib/blocker.rb, line 496 496: def inspect 497: "OneOf #{@classes.join(',')} -> #{@obj.class} -> #{@obj.inspect}" 498: end
# File lib/blocker.rb, line 510 510: def internal_deblock(io) 511: @obj = nil 512: with_guarded_io_pos(io) do 513: @classes.each do |obj| 514: if obj.deblock(io) 515: @obj = obj 516: break 517: end 518: false 519: end 520: end 521: @obj 522: end