Module: Converter

Overview

author: Dominik Richter author: Christoph Hartmann

Instance Method Summary collapse

Instance Method Details

#convert_to_i(val) ⇒ Object

convert the value to an integer if we have numbers only otherwise we return the string



8
9
10
11
# File 'lib/utils/convert.rb', line 8

def convert_to_i(val)
  val = val.to_i if val =~ /^\d+$/
  val
end