Sha256: df373c2636e8a1169be1dbd6b67fd6a3e074a6f0f4dd6e64508265babe07de96
Contents?: true
Size: 641 Bytes
Versions: 3
Compression:
Stored size: 641 Bytes
Contents
module Json module Streamer class Conditions attr_accessor :yield_value, :yield_object, :yield_array def initialize(yield_level: -1, yield_key: nil) @yield_level = yield_level @yield_key = yield_key @yield_value = ->(aggregator:, value:nil) { yield?(aggregator) } @yield_object = ->(aggregator:, object:nil) { yield?(aggregator) } @yield_array = ->(aggregator:, array:nil) { yield?(aggregator) } end private def yield?(aggregator) aggregator.level.eql?(@yield_level) or (not @yield_key.nil? and @yield_key == aggregator.key) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json-streamer-2.1.0 | lib/json/streamer/conditions.rb |
json-streamer-2.0.1 | lib/json/streamer/conditions.rb |
json-streamer-2.0.0 | lib/json/streamer/conditions.rb |