---
title: "Discussion on \"Understanding Getter and Setter Methods in Ruby💎\" | Hashnode"
description: "Discussion on \"Understanding Getter and Setter Methods in Ruby💎\". Why?\nGetter and setter methods in Ruby provide a controlled way to access and modify the values of instance variables from outside the class. This helps maintain data integrity and adheres to the principle of encapsulation, which means hiding the int..."
url: "https://hashnode.com/posts/understanding-getter-and-setter-methods-in-ruby/6688cb9d532677e7e703af20"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Understanding Getter and Setter Methods in Ruby💎](https://blog.aniketpatidar.com/understanding-getter-and-setter-methods-in-ruby?utm_source=hashnode&utm_medium=feed)

Why? Getter and setter methods in Ruby provide a controlled way to access and modify the values of instance variables from outside the class. This helps maintain data integrity and adheres to the principle of encapsulation, which means hiding the int...

Jul 6, 2024 · 2 min read · blog.aniketpatidar.com  
Read the article

## Written by

[Aniket Patidar](https://hashnode.com/@aniketpatidar)

@aniketpatidar · Indore, India

  
[View profile](https://hashnode.com/@aniketpatidar)

It works on my machine.

An enthusiastic Full Stack Ruby on Rails Engineer from India, who enjoys writing from time to time. I started this blog as a way of motivating myself into making meaningful contributions. Most of these writings are Ruby posts with a few smatterings of opinion with regard to developer life.

## Responses 1

Markdown supported · ⌘↵ to post

[Pushpendra Kumar Ahirwar](https://hashnode.com/@pushpendra18)

[Jul 6, 2024](https://hashnode.com/posts/understanding-getter-and-setter-methods-in-ruby/6688cb9d532677e7e703af20/comment/66895c8895335c0a56062aaf)

thank you ❤️

[Aniket Patidar](https://hashnode.com/@PatidarAniket)

[Jul 6, 2024](https://hashnode.com/posts/understanding-getter-and-setter-methods-in-ruby/6688cb9d532677e7e703af20/comment/66895c8895335c0a56062aaf#reply-6689885565e572809109bdff)

Most welcome 😊
