<commit_before>module God
  module Conditions
    
    class DiskUsage < PollCondition
      attr_accessor :above, :mount_point
      
      def initialize
        super
        self.above = nil
        self.mount_point = nil
      end
      
      def valid?
        valid = true
        valid &= complain("Attribute 'mount_point' must be specified", self) if self.mount_point.nil?
        valid &= complain("Attribute 'above' must be specified", self) if self.above.nil?
        valid
      end
      
      def test
        usage = `df | grep -i " #{self.mount_point}$" | awk '{print $5}' | sed 's/%//'`
        usage.to_i > self.above
      end
    end
    
  end
end<commit_msg>add conditional to disk_usage<commit_after>module God
  module Conditions
    
    class DiskUsage < PollCondition
      attr_accessor :above, :mount_point
      
      def initialize
        super
        self.above = nil
        self.mount_point = nil
      end
      
      def valid?
        valid = true
        valid &= complain("Attribute 'mount_point' must be specified", self) if self.mount_point.nil?
        valid &= complain("Attribute 'above' must be specified", self) if self.above.nil?
        valid
      end
      
      def test
        usage = `df | grep -i " #{self.mount_point}$" | awk '{print $5}' | sed 's/%//'`
       if usage.to_i > self.above
          self.info = "disk space out of bounds"
          return true
        else
          self.info = "disk space ok"
          return false
        end
      end 
    end
  end
end
{'fraction_non_alphanumeric': 0.08978529603122967, 'fraction_numerical': 0.0013012361743656475, 'mean_word_length': 1.7562724014336917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7637448', 'n_tokens_mistral': 455, 'n_tokens_neox': 436, 'n_words': 139}