Ruby script and boolean

I have found a way to verify boolean of false.
I found it here stackoverflow

        if event.get(field) and event.get(field).class != Hash
          event.set(field, {'original_value' => event.get(field)})
        elsif (!!event.get(field) == event.get(field)) and event.get(field).class != Hash
          event.set(field, {'original_value' => event.get(field)})
        end

So either it is true and no Hash or the double negative of false is "false" and this equals to "false".

Maybe someone needs this.

Greetings
Malte

1 Like