On Oct 20, 2011, at 1:38 AM, Jason Lillywhite wrote:
> If @yn is updated, automatically run method "foo.calcArea". The way I
> have it now requires me to do:
>=20
> foo.yn =3D 100.0
> foo.calcArea
>=20
> There must be a way to let ruby call that method for me.


Just define the attribute writer method yourself instead of using the =
helpers:

class Foo
  attr_reader :yn
  def yn=3D(value)
    @yn =3D value
    calcArea
  end

  def calcArea
     puts "recomputing area"
  end
end

>> f =3D Foo.new      #=3D> #<Foo:0x1895458>
>> f.yn =3D 100       #=3D> 100
recomputing area
>> f.yn             #=3D> 100


Gary Wright