A subscription is required to view this video. Enroll Today

Ruby

Ruby Idioms

  • Caike
  • 2230 views

Learn how to use Ruby Structs as class constructors in Ruby. We'll review the benefits and the potential pitfalls of this approach.

Comments

mwallisch said

Still new to ruby so maybe I'm missing something... It looks really neat but taking away a classes possibility of inheritance just to save a few lines of code? I don't know, doesn't feel right in terms of flexibilty. Apart from that: very good video!

Alex Braha Stoll said

Interesting idiom, I will try it later! However, I still feel it is better to stick with initialize (only because it is the convention and I don't think there are lots of advantages in using the Struct idiom).

Download

Share