Skip to content

Struct does not support method names with question marks?

April 5, 2012

I was looking into creating a Struct using a method name that has question mark, and was hitting a problem:

1.9.3p125 :001 > MockResult =, :success?)
 => MockResult 
1.9.3p125 :002 > r ='test', false)
 => # 
1.9.3p125 :003 > r.error_message
 => "test" 
1.9.3p125 :004 > r.success?
NoMethodError: undefined method `success?' for #
	from (irb):4
	from /Users/gagan/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `'

Then I hit this blog post:

but i still don't think ruby struct supports method names with question marks

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: