Sha256: 0b88ddbe11a0c8cb827ab90e2cf01cc1bbff1775f315b0fe93820180159bc8b4

Contents?: true

Size: 531 Bytes

Versions: 3

Compression:

Stored size: 531 Bytes

Contents

module FileScanner
  module Filters
    def self.defaults
      constants.map do |name|
        self.const_get(name).new
      end
    end

    class LastAccess
      DAY = 3600*24

      def initialize(atime = Time.now-30*DAY)
        @atime = atime
      end

      def call(file)
        @atime >= File.atime(file)
      end
    end

    class SizeRange
      def initialize(min: 100, max: Float::INFINITY)
        @range = min..max
      end

      def call(file)
        @range === File.size(file)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
file_scanner-1.0.5 lib/file_scanner/filters.rb
file_scanner-1.0.4 lib/file_scanner/filters.rb
file_scanner-1.0.3 lib/file_scanner/filters.rb