Ruby multi-method access concept

class Testruby 

    def initialize
        
        @user=[name:"sandip",age:"23",hubby:"problem solving"]
    end

    def user
        print "my name is #{@user.first[:name]} \n"
        return self
    end

    def age
        print "my age is #{@user.first[:age]} \n"
        return self 
    end

    def hubby 
        print "I like to #{@user.first[:hubby]} \n"
        return self
    end
end

Leave a Comment

Your email address will not be published. Required fields are marked *