Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Class question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Justin To, post: 4610190"] class Box attr_reader :exceptions def initialize exceptions = Hash.new end def exceptions? if(!exceptions.empty?) puts "error" else puts "No exceptions found." end end end box = Box.new box.exceptions? This prints out the error: TEST.rb:11:in `exceptions?': undefined method `empty?' for nil:NilClass (NoMethodError) from TEST.rb:23 Why is my exceptions hash a NilClass?? Thanks!! [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Class question
Top