Struct in Ruby

Mehdi Farsi
Aug 20, 2018 · 4 min read

The Struct class

irb> Struct.class
=> Class
irb> Struct.ancestors
=> [Struct, Enumerable, Object, Kernel, BasicObject]

Structure types and structures

Structure type definition behind the scene

irb> Struct.allocate
TypeError (allocator undefined for Struct)
irb> Struct.methods(false)
=> [:new]

ONE MORE THING ⬇

Feel free to subscribe here: www.rubycademy.com


rubycademy

E-Learning platform for Ruby and Ruby on Rails

Mehdi Farsi

Written by

Founder of www.rubycademy.com — I blog about Ruby & ROR - Paris

rubycademy

E-Learning platform for Ruby and Ruby on Rails