Re: When are attr_reader type methods called?

class A
call_this (“hello world”)
def call_this(arg)
p arg
end
end

gives me

NoMethodError: undefined method `call_this’ for A:Class
from (irb):3

So you’re obviously doing something more than just what you posted -
what’s in the …?

class A
attr_reader :monkeys
end

is roughly equivalent to writing:

A = Class.new
A.define_method :monkeys {
instance_variable_get(:@monkeys)
}

Is that what you’re asking? Try posting a short piece of code with
actual and expected outputs.

#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by NetIQ MailMarshal
#####################################################################################