Ruby

Ruby is a programming language. It stands out for its syntax, community, legibility, simplicity and power. Come on and start to play with Ruby!

Articles

Assignments in conditionals

Assignments in conditionals In Ruby, we can assign a value to a variable in a conditional. For example: if v = foo puts v end When we write this code, Rubocop show us a warning: Assignment in condition - you probably meant to use ==. This is... Read.more

Installing troubled gems in Mac OS X

Sometimes, installing a gem in Mac OS can be a hard work. I fought with dependencies and compilers, and those are the solutions I found: Nokogiri brew install libxml2 libxslt libiconv brew link libxml2 libxslt libiconv xcode-select --install gem install nokogiri -- --use-system-libraries Libv8 gem... Read.more

Execute sudo commands with Net::SSH

Net::SSH is a Ruby implementation of an SSH (protocol 2) client. With this gem, you can interact with remote servers and execute commands. The features from README are: Execute processes on remote servers and capture their output Run multiple processes in parallel over a... Read.more

Reduce nil verifications in nested hashes

Rails provide us multiple methods to help developers and we are used to calling them, check the article Living outside Rails for more info ;). To write Ruby scripts return us to the core language. Recently I work in a script to parse data from an... Read.more

Mathematical signs and method invocation in Ruby

Ruby is a flexible language. An example of this flexibility is the optional parenthesis on method invocation. result = my_method arg # Same result result = my_method(arg) A mistyping can change the behaviour of our code. In mathematical operations, the position of the signs doesn't... Read.more