Method: Wpxf::IntegerOption#valid_integer?

Defined in:
lib/wpxf/core/opts/integer_option.rb

#valid_integer?(value) ⇒ Boolean

Returns true if the value is a valid integer.

Parameters:

  • value

    the value to validate.

Returns:

  • (Boolean)

    true if the value is a valid integer.



39
40
41
# File 'lib/wpxf/core/opts/integer_option.rb', line 39

def valid_integer?(value)
  value && !value.to_s.match(/^0x[0-9a-fA-F]+$|^-?\d+$/).nil?
end