def define_singleton(r, sym, method)
      name = r.send(sym)

      if name && name !~ /\W/ && !r.respond_to?(name) && !respond_to?(name)
        instance_eval(%Q{def #{name}\n#{method}('#{name}')\nend})
      end
    end
def define_singleton(r, sym, method)
      name = r.send(sym)

      if name && name !~ /\W/ && !r.respond_to?(name) && !respond_to?(name)
        instance_eval(%Q{def #{name}\n#{method}('#{name}')\nend})
      end
    end
Convenience method to define a no-argument singleton method on
 this object.