[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01798] Re: date2 and the new Symbol stuff

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-10 09:31:02 UTC
List: ruby-talk #1798
Hi,

In message "[ruby-talk:01796] date2 and the new Symbol stuff"
    on 00/03/09, Dave Thomas <Dave@thomases.com> writes:

|I could either submit a patch which changed all the {id}'s to
|{id.id2name}, or we could change Symbol.to_s to return "julian", not
|":julian".

Since `#{id}' in the quoted code suppose number to be interpolated,
changing Symbol.to_s to return "julian" does not solve the problem.

I changed once() like the following, which runs fine on older Ruby too.

    def once(*ids)
      for id in ids
	p id
	module_eval <<-"end;"
	  alias_method :__#{id.to_i}__, #{id.to_i}
	  def #{id.id2name}(*args, &block)
	    def self.#{id.id2name}(*args, &block); @__#{id.to_i}__ end
	    @__#{id.to_i}__ = __#{id.to_i}__(*args, &block)
	  end
	end;
      end
    end

							matz.

In This Thread