Sha256: 06c025f7571b0b49ba8b89c7ceba3f4606b44451a234b2d18cbc5aec54dbf047
Contents?: true
Size: 710 Bytes
Versions: 11
Compression:
Stored size: 710 Bytes
Contents
# frozen_string_literal: true module Orthoses # Filter current store. # filter stored key and value if proc return true # use Orthoses::Filter do |name, content| # Orthoses.rbs_defined_class?(name) # end class Filter def initialize(loader, if: nil, &block) @loader = loader @if = binding.local_variable_get(:if) @block = block || @if || raise(ArgumentError, "should give a block") end def call @loader.call.tap do |store| store.filter! do |name, content| @block.call(name, content).tap do |bool| Orthoses.logger.debug("[Filter] #{bool ? "Pass" : "Reject"} [#{name}]") end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems