Get the latest tech news

Moment of Ruby: An Argument for Nothing


Last week I learned a technique in Ruby so small and useful, I couldn't believe I hadn't come across it before. Suppose a method doubles as a getter and setter. Pass a value to update a setting, or pass nothing to read it: module Cloakable def clo

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Moment

Moment

Photo of ruby

ruby

Photo of argument

argument

Related news:

News photo

‘Rings of Power’ Star Daniel Weyman on the Moment Gandalf Finally Gets His Hat

News photo

Cloud gaming was once billed as cheaper than buying titles. But new pricing from Microsoft’s Xbox is eroding that argument, gamers say

News photo

Does Ruby on Rails still make sense?