[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Trying to understand assert_valid_keys

Steve L

4/21/2006 2:58:00 AM

Hello,

I'm trying to learn more about ruby by reading some of the source code
for ruby on rails. I was just looking at the method assert_valid_keys. The
code for the method is as follows
# File activesupport/lib/active_support/core_ext/hash/keys.rb, line 46
def assert_valid_keys(*valid_keys)
unknown_keys = keys - [valid_keys].flatten
raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless
unknown_keys.empty?
endWhat I am puzzled by is that I don't understand where/how the variable
'keys' is defined?Could someone please help me understand this better?
Janak


1 Answer

Trans

4/21/2006 3:04:00 AM

0

keys is method of the Hash class. If you spelled it out long ways it
would be

self.keys()

T.