This code is provided as an example in for use with devise and OmniAuth, it works in my project.
class User < ActiveRecord::Base
def self.new_with_sessi
Ruby doesn't care about types in conditionals, unlike Java. As long as the value is neither nil or false then it will pass.
In your example you actually discriminate against nil: the if conditionnal ensures that data actually exists and isn't nil, so we can use it, assuming it's a hash. This is a common pattern in Ruby.