Ruby one of the method of creating a single ton method | Ruby, single ton method

cat = String.new("cat")
def cat.speak
    'miaow'
end
cat.speak #=> "miaow" 
cat.singleton_methods #=> ["speak"] 

Comments

Popular posts from this blog

Rails Memcache issues

scp command usage guide

ROR HEROKU Working with file storage like paperclip in heroku for free of cost ( paperclip and dropbox) paperclip-dropbox config | ROR, HEROKU, file storage, paperclip, in heroku, free of cost, paperclip, dropbox, paperclip-dropbox config