Sha256: e28d54c80fc3d54e741d8cf54fd6d98fcc2e5ead3f481a6731360f24de2c1ecf
Contents?: true
Size: 543 Bytes
Versions: 10
Compression:
Stored size: 543 Bytes
Contents
# frozen_string_literal: true module Shipit module ConditionalAttributes extend ActiveSupport::Concern module ClassMethods def inclusion_method_for(attribute) @inclusion_cache ||= {} @inclusion_cache.fetch(attribute) do method = "include_#{attribute}?" method_defined?(method) && method end end end def filter(*) super.reject do |attribute| method = self.class.inclusion_method_for(attribute) method && !send(method) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems