Sha256: 33675f7ec4c41e70c07bab35f97eb7c5baf62d627c290f3ea43bae3143337fca
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
class SimpleRotate module Validator def valid_file_name # stdout only if @file_name.is_a?(Symbol) && @file_name == :STDOUT @only_stdout = true return true end # not string if !@file_name.is_a?(String) SimpleRotate::Error.argv("file_name", @file_name) end # directory? if File.directory?(@file_name) msg = "ERROR => #{@file_name} is a Directory!" SimpleRotate::Error.warning(msg) SimpleRotate::Error.argv("file_name", @file_name) end return true end def valid_int(param, argv) if !argv.is_a?(Integer) SimpleRotate::Error.argv(param, argv) elsif argv < 0 msg = %{You can't specify the negative value!} SimpleRotate::Error.warning(msg) SimpleRotate::Error.argv(param, argv) end end def valid_bool(param, argv) argv = true if argv == 1 argv = false if argv == 0 if !(argv.instance_of?(TrueClass) || argv.instance_of?(FalseClass)) SimpleRotate::Error.argv(param, argv) end return true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simple_rotate-1.2.0 | lib/simple_rotate/internal/validator.rb |
simple_rotate-1.1.1 | lib/simple_rotate/internal/validator.rb |
simple_rotate-1.1.0 | lib/simple_rotate/internal/validator.rb |