Sha256: 3c1bbd2bcd290590836a0028c6b876dd131b893a7148c0712ecc398a895c6b6c

Contents?: true

Size: 531 Bytes

Versions: 9

Compression:

Stored size: 531 Bytes

Contents

# -*- encoding: utf-8 -*-
module Bluepill
  module ProcessConditions
    class FileTime < ProcessCondition
      def initialize(options = {})
        @below = options[:below]
        @filename = options[:filename]
      end

      def run(pid, include_children)
        if File.exists?(@filename)
          Time.now()-File::mtime(@filename)
        else
          nil
        end
      rescue
        $!
      end

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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
cloud66-bluepill-0.0.64 lib/bluepill/process_conditions/file_time.rb
bluepill-0.0.68 lib/bluepill/process_conditions/file_time.rb
bluepill-0.0.67 lib/bluepill/process_conditions/file_time.rb
bluepill-0.0.66 lib/bluepill/process_conditions/file_time.rb
bluepill-0.0.65 lib/bluepill/process_conditions/file_time.rb
bluepill-0.0.64 lib/bluepill/process_conditions/file_time.rb
cloud66-bluepill-0.0.63 lib/bluepill/process_conditions/file_time.rb
bluepill-0.0.63 lib/bluepill/process_conditions/file_time.rb
cloud66-bluepill-0.0.62 lib/bluepill/process_conditions/file_time.rb