Module: Checker
- Included in:
- Calcpace
- Defined in:
- lib/calcpace/checker.rb
Overview
Module to check if the input is valid or of the correct type
Instance Method Summary collapse
Instance Method Details
#check_positive(number) ⇒ Object
5 6 7 |
# File 'lib/calcpace/checker.rb', line 5 def check_positive(number) raise 'It must be a X.X positive number' unless number.positive? end |
#check_time(time_string) ⇒ Object
9 10 11 |
# File 'lib/calcpace/checker.rb', line 9 def check_time(time_string) raise 'It must be a XX:XX:XX time' unless time_string =~ /\d{0,2}(:)*?\d{1,2}(:)\d{1,2}/ end |