Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6701575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:57:01+00:00 2026-05-26T06:57:01+00:00

How to check if instance variable value have changed? For global variable there is

  • 0

How to check if instance variable value have changed?

For global variable there is a trace_var method
http://apidock.com/ruby/Kernel/trace_var

But I didn’t found any information how to do that with instance variables(or class one).

I didn’t use Rails.

Ruby 1.9.2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:57:02+00:00Added an answer on May 26, 2026 at 6:57 am

    The best approach might be to avoid accessing and manipulating the instance variable directly and instead go through an attr_accessor style interface.

    This gives you the ability to do things like this:

    def my_attr=(value)
      logger.debug("my_attr changed to #{value.inspect}")
      @my_attr = value
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot change the value of an instance variable inside a function. I have
How can I retrieve a bash variable value if I have the variable name
If I have (in .NET/C#) for instance a variable of type long I can
Consider the double-check idiom for lazy initialization of instance fields: // Item 71 in
I need to filter out anchor tags in a string. For instance, Check out
Is there a way to automatically check existing C# source code for instances of
I have two instances running of same Windows Service. They check the health of
Support I have a Java Bean class that strictly holds instance fields: class College
I have am writing a Python function that takes a timeout value as a
For trying out some pointer stuff, I made an instance variable in an existing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.