Class: MinimumSize

Inherits:
AbstractCheck show all
Defined in:
lib/standard_checks.rb

Overview

Ensures that the size of the file is not too small.

Constant Summary collapse

BYTES_HASH =
{'default' => 1,
/^b/i => 1,
/^kb/i => 1024,
/^mb/i => 1024**2,
/^gb/i => 1024**3}

Instance Attribute Summary

Attributes inherited from AbstractCheck

#errors, #path

Instance Method Summary collapse

Methods inherited from AbstractCheck

#add_error, check_name, children, get_check_name, inherited, #initialize, #run_check, #unit_parse

Constructor Details

This class inherits a constructor from AbstractCheck

Instance Method Details

#check(path_obj, options) ⇒ Object



35
36
37
38
39
40
# File 'lib/standard_checks.rb', line 35

def check(path_obj,options)
  bytes = unit_parse(options,BYTES_HASH)
  unless path_obj.size >= bytes
    add_error("file is too small")
  end
end