Sha256: 174fdba931aea885861ea1609dd50b523784c9de3cd3533467c42ed704f133a2
Contents?: true
Size: 459 Bytes
Versions: 22
Compression:
Stored size: 459 Bytes
Contents
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
Version data entries
22 entries across 22 versions & 1 rubygems