What is the meaning of “do | |” in Ruby?
It’s a way of defining arguments for a block, in a similar way to def methodname(arg1, arg2) A nice explanation of blocks is available from Robert Sosinski
It’s a way of defining arguments for a block, in a similar way to def methodname(arg1, arg2) A nice explanation of blocks is available from Robert Sosinski
To begin with, send and call are two very different methods. In ruby, the concept of object orientation takes its roots from Smalltalk. Basically, when you call a method, you are sending that object a message. So, it makes sense that when you want to dynamically call a method on an object, the method you call is send. This method has existed in … Read more
From the RVM support site: RVM installs everything into ~/.rvm. To remove RVM from your system run ‘rm -rf ~/.rvm’. You may have one additional config file in ~/.rvmrc and of course the RVM hook in your bash/zsh startup files. So, just go to the command line and type rm -rf ~/.rvm All the installed gems are in … Read more
<!– <% end %> –> what is this doing? a html commented ERB tag will still evaluate. Remove it. if you want to comment ruby code use # instead, like <% #end %>
It could be as simple as a stale PID file. It could be failing silently because your computer didn’t complete the shutdown process completely which means postgres didn’t delete the PID (process id) file. The PID file is used by postgres to make sure only one instance of the server is running at a time. So when it goes to … Read more
Unfortunately appears that ruby-install just downloads and compiles Ruby, with no option to remove it, unlike RVM or rbenv. So, probably you’ll need to run some manual commands here to delete all installed files. 1. Locate it Usually ruby-install will install rubies in ~/.rubies/ folder. If you’re not sure which ruby was installed using ruby-install, locate the file .installed.list, as it has a list of installed … Read more
This is how it looks (via screenshot) – otherwise it’s hard to interpret how the above comments will look. Click to Zoom-in:
This is because you are calling method choices, before defining it. Write the code as below: I used break, to exit from the while loop. Otherwise it will create an infinite loop.
You’re looking for include?:
I’ll join the fun with: EDIT: Some string interpolation to add the first and last single quote 😛