From: Panagiotis Atmatzidis Date: 2013-01-20T23:08:00+09:00 Subject: 2Q: Getting first 4 elements from array and calling class methods directly Hello fellow Rubyists! I have written a quick n dirty code to display the first 4 RSS entries from a feed using "feedzirra" gem. The code is pretty straight forward: https://gist.github.com/4578863 I have two questions, related to this code: 1) Is there any more elegant[1] way to get the first for elements of '@entries' object array? 2) How should be defined the "feed_list" method in order to be called like: feed = NewsDisplay::feed_list I know I should put a 'self' reference somewhere. A little explanation of who this technique works would be nice. I know that Class::method calls might be deprecated in the future. However even "Class.method" looks much more elegant and I'd like to know how to implement it. Best Regards, [1] Elegant = Easy to read, concise code snippet. Cryptic snippets are not elegant imho. Panagiotis (atmosx) Atmatzidis email: atma@convalesco.org URL: http://www.convalesco.org GnuPG ID: 0xE736C6A0 gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0 -- The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."