Method: Wpxf::IntegerOption#normalize

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

#normalize(value) ⇒ Integer

Returns a normalized value to conform with the type that the option is conveying.

Parameters:

  • value

    the value to normalize.

Returns:

  • (Integer)

    a normalized value to conform with the type that the option is conveying.



29
30
31
32
33
34
35
# File 'lib/wpxf/core/opts/integer_option.rb', line 29

def normalize(value)
  if value.to_s.match?(/^0x[a-fA-F\d]+$/)
    value.to_i(16)
  else
    value.to_i
  end
end