How to remove all non-digits from a string in ruby?
If the first argument of the tr method of String starts with ^, then it denotes all characters except those listed. def canonical_form str str.tr(‘^0-9’, ”) end
If the first argument of the tr method of String starts with ^, then it denotes all characters except those listed. def canonical_form str str.tr(‘^0-9’, ”) end
I finally found the cause of the problem! Though I am still uncertain how this problem came about. Look at the contents of the mkmf.log file that is created when my install command fails (see my original post). It logs an attempt to run the following command /usr/bin/gcc-4.2 …and so on… There is no /usr/bin/gcc-4.2 … Read more
What about FileUtils.rm_rf(“#{dir_path}/.”, secure: true)?
Use this to kill sidekiq forcefully. ps -ef | grep sidekiq | grep -v grep | awk ‘{print $2}’ | xargs kill -9
They are used in different places. summary is seen you do gem list -d, while description is seen on http://rubygems.org. Description “should be more detailed than summary” (http://guides.rubygems.org/specification-reference/), but in reality you see s.description = s.summary in .gemspecs a lot.
They seem to be aliases for the same thing. From the documentation you can see that the sample code of intern uses to_sym: intern → symbol Returns the Symbol corresponding to str, creating the symbol if it did not previously exist. See Symbol#id2name. “Koala”.intern #=> :Koala s=”cat”.to_sym #=> :cat s == :cat #=> true s=”@cat”.to_sym … Read more
If you are using Vim 7.3, you should have the MatchIt vim macro available. Add runtime macros/matchit.vim to your .vimrc file and you should be able to use % to match the ruby blocks. You can look at the filetype plugin for ruby to see what it will move between.
What does the second warning mean? Is it related to the first warning? There is a single warning with a text split into two lines. It literally says: args should be converted to **args, here is the call that produced this warning, here is its definition for your convenience.
To save you some legwork, in Eclipse: Go to Help -> Install New Software… Click add (top right of popup) Enter a Name like “RadRails2” Enter the location as http://download.aptana.com/tools/radrails/plugin/install/radrails-bundle (for the full Aptana studio Studio 3, instead enter http://download.aptana.com/studio3/plugin/install) Click ok Restart Eclipse Go to Window -> Preferences. You will see Ruby is enlisted … Read more
In fact you can define a module inside of another module, and then include it within the outer one. so ross$ cat >> mods.rb module ApplicationHelper module Helper def time Time.now.year end end include Helper end class Test include ApplicationHelper def run p time end self end.new.run so ross$ ruby mods.rb 2012