Module: DataTypeValidationsHelper

Defined in:
lib/watir_helper/data_type_validations.rb

Overview

****************************************************** DataType Validation methods ******************************************************

Instance Method Summary collapse

Instance Method Details

#is_char?(value) ⇒ Boolean

Check whether the value entered is a Character or not.

Returns:

  • (Boolean)


32
33
34
# File 'lib/watir_helper/data_type_validations.rb', line 32

def is_char?(value) #Like "3", 3, "a", 'a', '!', '~' etc.
 (value.to_s).length == 1
end

#is_float?(value) ⇒ Boolean

Check whether the value entered is a Float or not.

Returns:

  • (Boolean)


12
13
14
# File 'lib/watir_helper/data_type_validations.rb', line 12

def is_float?(value)
 value.is_a?(Float)
end

#is_integer?(value) ⇒ Boolean

Check whether the value entered is an Integer or not.

Returns:

  • (Boolean)


7
8
9
# File 'lib/watir_helper/data_type_validations.rb', line 7

def is_integer?(value)
 value.is_a?(Integer)
end

#is_range?(value) ⇒ Boolean

Check whether the value entered is a Range or not.

Returns:

  • (Boolean)


27
28
29
# File 'lib/watir_helper/data_type_validations.rb', line 27

def is_range?(value)
 value.is_a?(Range)
end

#is_reg_exp?(value) ⇒ Boolean

Check whether the value entered is a Regular Expression or not.

Returns:

  • (Boolean)


22
23
24
# File 'lib/watir_helper/data_type_validations.rb', line 22

def is_reg_exp?(value)
 value.is_a?(Regexp)
end

#is_string?(value) ⇒ Boolean

Check whether the value entered is a String or not.

Returns:

  • (Boolean)


17
18
19
# File 'lib/watir_helper/data_type_validations.rb', line 17

def is_string?(value)
 value.is_a?(String)
end