Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AuthorizationException < Exception
- end
- class User
- attr_accessor :name, :email, :password, :address, :refferal_id
- def tweets
- @tweets = Array.new
- end
- def tweets=(tweet)
- @tweets.push
- end
- def initialize(name, email, password, details = {})
- self.name = name
- self.email = email
- self.password = password
- self.address = details[:address]
- self.refferal_id = details[:refferal_id]
- end
- def get_tweets(list)
- unless list == "Abhimanyu Aryan"
- raise AuthorizationException.new
- end
- @tweets
- end
- begin
- tweets = get_tweets("Abhimanyu Aryan")
- rescue AuthorizationException
- puts "Authentication Error"
- end
- end
- user = User.new "Abhimanyu Aryan", "abhimanyuaryan@mail.com", "1234", :address => "stackoverflow"
Add Comment
Please, Sign In to add comment