Sha256: 5c6cd8ba1c55fe41d4438fbbf1506c3b0bfbbb5bed7b19c5d72b5317929f32ea

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

module Bluepill
  module ProcessConditions
    class FileTime < ProcessCondition
      def initialize(options = {})
        @below = options[:below]
        @filename = options[:filename]
      end

      def run(_pid, _include_children)
        if File.exist?(@filename)
          Time.now - File.mtime(@filename)
        else
          nil
        end
      rescue
        $ERROR_INFO
      end

      def check(value)
        return false if value.nil?
        value < @below
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bluepill-0.0.69 lib/bluepill/process_conditions/file_time.rb