From: Gregory Brown Date: 2008-08-02T06:05:35+09:00 Subject: Re: Help finding this syntax error On Fri, Aug 1, 2008 at 4:53 PM, Patrick Li wrote: > Hmm that makes more sense. > But now i'm confused why my code worked after removing the outside > parenthesis. > > when i type this: > if FieldTypes.key? field && FieldTypes[field].respond_to? :select > > shouldn't ruby be seeing this? > if (FieldTypes.key? field && FieldTypes[field].respond_to?) :select > > which is still a syntax error? > > Am i calculating what i think i'm calculating? No idea. Adapting your code a bit but using a similar syntax: >> hash = {} => {} >> field = :foo => :foo >> if hash.key? field && hash[field].respond_to? :select >> p 'foo' >> end SyntaxError: (irb):53: syntax error, unexpected tSYMBEG, expecting keyword_then or ';' or '\n' if hash.key? field && hash[field].respond_to? :select ^ (irb):55: syntax error, unexpected keyword_end, expecting $end from /Users/sandal/lib/ruby19/bin/irb:12:in `
' -- Killer Ruby PDF Generation named after a magnificent sea creature: http://github.com/sandal/prawn | Non-tech stuff at: http://metametta.blogspot.com