Ruby lets you redefine backticks
This actually works:
class Klass
def initialize
`hi world`
end
def `(message)
puts "Called with backticks: #{message}"
end
end
Klass.new # Prints "Called with backticks: hi world"
Hat tip to @jcoglan Show archive.org snapshot .
Related cards:
The Exciter - Why You Should Deploy Your Next Application on Ruby 1.9 and a Rant in General
The rubyforge gems model may not be perfect, but damnit people, when there’s a gem update I know that it has actually been tested somewhat and it’s not just whatever random point HEAD happens to be at, at that point in time, by some random Joe who...
RubySpec - The Standard You Trust
RubySpec is a project to write a complete, executable specification for the Ruby programming language.
How Ruby lets you keep script and data in *one* file
The __END__
keyword tells Ruby where a file ends – but you don't have to stop there. Any text you add after it is accessible via the DATA
object.
The attached example file data.rb
looks like this:
puts DATA.read
__END__
DATA is a File ...
RubyMine: You can disable inspections you don't care about
When you find yourself constantly ignoring a RubyMine warning, you can simple disable that warning and de-clutter your editor. E.g. in my Cucumber scenarios RubyMine underlines 90% of all lines because it does not know about [spreewald](https://gi...
RubyMine: Set specific Ruby version per project
If your project uses another version than your default Ruby, RubyMine will give you incorrect inspections, for example.\
Here is how to switch which Ruby you use in RubyMine.
- File → Settings (Or press
Ctrl+Alt+S
) - Select "Ruby SDK and Gem...
Missing certificates for rubygems and bundler in Ruby 1.8.7
Using Ruby 1.8.7 you will not be able to use the maximum versions Rubygems 1.8.30 and Bundler 1.17.3 with https://rubygems.org/
anymore. This is a result of a server certificate on December 5th, 2020. The resulting errors will...
Rubygems: Installing the last version of rubygems that has no rubyforge_project deprecation warning
You can install rubygems 3.0.8
(released on February 18, 2020) to keep all the Gem::Specification#rubyforge_project
deprecation warnings away from your development log. With Rubygems >= 3.1
this deprecation warning was introduced. While main...
edgecase's ruby_koans at master - GitHub
The Ruby Koans walk you along the path to enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not just something we pay lip...
List RubyGems binary version for all installed Ruby versions
rbenv
To check which rubygems versions your different rbenv rubys are using, you can use this small bash script:
for i in $(rbenv versions --bare); do rbenv shell "${i}"; echo -n "ruby ${i} has gem version: "; gem -v; done
RVM
``...
Fix Capistrano with RubyGems 1.6
After updating your RubyGems, you will probably not be able to run Capistrano any more, but receive an error similar to this:
can't activate net-ssh (= 2.0.22) for [], already activated net-ssh-2.1.0 for [] (Gem::LoadError)
If you have B...