Class: ApacheCrunch::CLFIntegerCast

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

Overview

Converts a CLF-formatted string to an integer

“CLF-formatted” means that if the value is 0, the string will be a single hyphen instead of a number. Like %b, for instance.

Instance Method Summary collapse

Instance Method Details

#cast(string_value) ⇒ Object



14
15
16
17
18
19
# File 'lib/cast.rb', line 14

def cast(string_value)
    if string_value == "-"
        return 0
    end
    string_value.to_i
end