TIL: Named Structs
Named structs in Ruby
Naming structs makes intent clearer (and avoids annoying Rubocop).
I'm used to writing structs like this:
Person = Struct.new(:firstname, :lastname)
person = Person.new('Billy', Ruffian')
Better is to declare the struct like this:
Struct.new('Person', :firstname, :lastname)
person = Struct::Person.new('Billy', 'Ruffian')
Member discussion