Struct Ruby की एक built-in class है जो कुछ attributes को एक साथ bundle करने वाली simple classes को जल्दी बनाने के लिए है — constructor, accessors, equality, और बहुत कुछ automatically generate करती है। यह एक पूर्ण class लिखे बिना lightweight data classes को define करने का एक concise तरीका है।
Struct जिस problem को हल करता है
,
()
= x
= y
()
x == other.x && y == other.y
= .new(, )
