From: Carolyn Grant Date: 2012-11-11T13:21:27+09:00 Subject: Instance name of a class/object? Hi! I'm quite new to Ruby, and am quite confused about instance names. I am in the middle of writing an app that has a good number of configuration files, and I'd like to write: basic_config = MySettings.new # Picks up & processes basic_config.yml adv_config = MySettings.new # Picks up & processes adv_config.yml I'm using SettingsLogic to the hard work, so MySettings looks a bit like this: class MySettings < SettingsLogic source instance.name # For example # Do some other stuff end I tried my_class.name; that returns a "Method not defined" error" (I'm using 1.9.3p194) What I'd really like to avoid is: basic_config = MySettings.new(basic_config). As far as I can tell, what I want to do isn't possible. I did ask on StackOverflow and Boris was a great help, but his code requires a :name => some_name flag. So I figured I'd ask here and see if anyone can help me! Can I do what I want to do? Thanks in advance! Carolyn -- Posted via http://www.ruby-forum.com/.