lib/authlane/serializeduser.rb
##
# Return a Hash representing the serialized object's attributes and values.
#
# If the whole Object that was stored is a Hash itself, its `to_h` will be called.
# Otherwise, the Object's instance methods are called and mapped to a Hash. This is
# only the case when the passed user object is not a Hash and no specific **attributes**
# for storage are set (see {#initialize})
#
# In either case, attribute names can be accessed by Symbol or String
# key alike.
#
# @return [Hash] the Hash representation of the stored object.
#
Return a Hash representing the serialized object's attributes and values.
If the whole Object that was stored is a Hash itself, its `to_h` will be called.
Otherwise, the Object's instance methods are called and mapped to a Hash. This is
only the case when the passed user object is not a Hash and no specific **attributes
for storage are set

In either case, attribute names can be accessed by Symbol or String
key alike.
Return a Hash representing the serialized object ' s attributes and values . If the whole Object that was stored is a Hash itself its ` to_h ` will be called . Otherwise the Object ' s instance methods are called and mapped to a Hash . This is only the case when the passed user object is not a Hash and no specific ** attributes for storage are set In either case attribute names can be accessed by Symbol or String key alike .
def to_h
        universal_hash = Hash.new
        if @user.is_a? Hash
          hash = @user.to_h
        else
          hash = {}
          @user.class.instance_methods(false).each do |key|
            hash[key] = @user.__send__ key
          end
        end
        hash.each_pair do |key, value|
          universal_hash[key.to_s] = value if key.is_a? Symbol
          universal_hash[key] = value
        end
        universal_hash
      end
def to_h universal_hash = Hash . new if @user . is_a? Hash hash = @user . to_h else hash = { } @user . class . instance_methods ( false ) . each do | key | hash [ key ] = @user . __send__ key end end hash . each_pair do | key , value | universal_hash [ key . to_s ] = value if key . is_a? Symbol universal_hash [ key ] = value end universal_hash end
Return a Hash representing the serialized object's attributes and values.
Return a Hash representing the serialized object ' s attributes and values .
the Hash representation of the stored object.
the Hash representation of the stored object .
Hash