Class: InputValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/core/input_validator.rb

Class Method Summary collapse

Class Method Details

.validate(*args) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/core/input_validator.rb', line 2

def self.validate *args
  args.each do |arg|
    unless validate_integer arg
      return false
    end
  end
  true
end

.validate_integer(str) ⇒ Object



11
12
13
14
15
16
# File 'lib/core/input_validator.rb', line 11

def self.validate_integer str
  if str.to_i > 0
    return true
  end
  false
end