Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ebcdic_converter.rb

Instance Method Summary collapse

Instance Method Details

#ebcdic_to_iObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ebcdic_converter.rb', line 37

def ebcdic_to_i
  stripped_me = strip
  if stripped_me.size > 0
    last_digit = stripped_me[-1..-1]
    last_digit =~ /^\d$/ ?
      stripped_me.to_i :
      to_ebcdic(stripped_me)
  else
    0
  end
end