Frontendrails logo Front End Rails

Ruby 2.4 has optimized lstrip and strip methods for single byte strings

Ruby 2.4 has optimized lstrip and strip methods for single byte strings

Bigbinary Bigbinary 14 March 2017

lstrip and rstrip methods have been optimized in ruby 2.4

Prototypes in Ruby and the strange story of dup

Prototypes in Ruby and the strange story of dup

Arkency Arkency 07 March 2017

Today I was working on a feature where I had to create a few similar Active Record objects. I was creating a read model for some financial data. Most of the attributes of created objects were the same but a few were different. In one refactoring step I removed the duplication in passing attributes by using a prototype. Although at that moment I haven't thought of the object in such way.

IO#readlines now accepts chomp flag as an argument

IO#readlines now accepts chomp flag as an argument

Bigbinary Bigbinary 07 March 2017

IO methods now have an optional chomp flag to remove newline return characters

How to Make Your Classes More Powerful by Implementing Equality

How to Make Your Classes More Powerful by Implementing Equality

Black Bytes Black Bytes 06 March 2017

How do you compare two things in Ruby? Using == as you already know… but did you know that == is a method & not just syntax? You can implement this method in your own classes to make them more powerful. And that’s what I want to talk about in this post. Equality Basics As […]

Unicode Normalization in Ruby

Unicode Normalization in Ruby

Honeybadger Honeybadger 06 March 2017

If you want Ruby's string methods to play nicely with Unicode, it's a good idea to normalize them. This article is a brief introduction to Unicode normalization for Rubyists.

Bundler Changed Where Your Canonical Ruby Information Lives: What You Need to Know

Bundler Changed Where Your Canonical Ruby Information Lives: What You Need to Know

Heroku Heroku 28 February 2017

Heroku bumped its Bundler version to 1.13.7 almost a month ago, and since then we've had a large number of support tickets opened, many a variant of the following:

Ruby 2.4 now has Dir.empty? and File.empty? methods

Ruby 2.4 now has Dir.empty? and File.empty? methods

Bigbinary Bigbinary 28 February 2017

No more platform specific code to check empty directories

The Story of Four Weathers, or You Don't Need an API Wrapper

The Story of Four Weathers, or You Don't Need an API Wrapper

zverok with ruby zverok with ruby 23 February 2017

Once Rubyist see a new useful HTTP API, her/his first thought would be “does it have a Ruby wrapper?”, and if not, the next would be “once, I should do a Ruby wrapper for this!”

Ruby 2.4 implements Integer#digits for extracting digits in place-value notation

Ruby 2.4 implements Integer#digits for extracting digits in place-value notation

Bigbinary Bigbinary 23 February 2017

Ruby 2.4 implements Integer#digits for extracting digits in place-value notation which is useful in calculating checksum digits.

Creating Powerful Command Line Tools in Ruby

Creating Powerful Command Line Tools in Ruby

Codeship Codeship 22 February 2017

When it comes to software development, a majority of the tools available to us are command-line applications. It is also well worth noting that many of the tools used on the command line are quite powerful in what they can accomplish, from the trivial to the tedious. Taking this further, you can combine command-line applications […]

Objects as Ruby Hash Keys

Objects as Ruby Hash Keys

Honeybadger Honeybadger 21 February 2017

One often-overlooked feature of Ruby's hashes is that you can use any object as a hash key, not just strings and symbols. In this post we examine how Optcarrot, the Ruby NES emulator, uses this feature to optimize its mapped memory implementation.

15 Weird Things About Ruby That You Should Know

15 Weird Things About Ruby That You Should Know

Black Bytes Black Bytes 20 February 2017

15 Weird Things About Ruby That You Should KnowBy Jesus CastelloRuby is an amazing language with a lot of interesting details that you may not have seen before...…in this post I compiled some of those details for your own enjoyment in a nice-looking list :)​ 1 Heredoc + Method If you have some data that you […]

When to include irb in Ruby 2.4.0

When to include irb in Ruby 2.4.0

Development Thoughts Development Thoughts 19 February 2017

I’ve only just got around to playing with ruby 2.4.0 which was released in late 2016. One of the new features of the language is introduced was Binding.irb.

Ruby code I no longer write

Ruby code I no longer write

Arkency Arkency 17 February 2017

When we learn programming languages and techniques we go through certain phases: Curiosity Admiration Overdosage Rejection Approval etc. Similarly with other things we enjoy in our life such as ice cream, pizza and sunbathing :) We learn to enjoy them, we try too much of it and learn the consequences. Hopefully some time later we find a good balance. We know, how much of it, we can use without hurting ourselves. I think we can have a similar experience in programming for example when you find out about metaprogramming, immutability, unit testing, DDD. Basically anything. We often need to hit an invisible wall and realize that we overdosed. It's not easy at all to realize it and learn from it. After 8 years of using Ruby and Rails, there are certain constructs that I try not to use anymore because I believe they make maintaining large applications harder.

Testing Ruby's Unicode Support

Testing Ruby's Unicode Support

Honeybadger Honeybadger 14 February 2017

To see how far Ruby's Unicode support has come, I tested every string method to see which ones violate the principle of least surprise. The results are presented as a handy table that you can reference to see which string manipulation methods are Unicode-unfriendly.