Project

General

Profile

Actions

Feature #3714

closed

Add getters for Enumerator

Added by marcandre (Marc-Andre Lafortune) over 13 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
[ruby-core:31761]

Description

=begin
Given an enumerator, there is no way to know what receiver, method and arguments it is based upon (although one could use Enumerator#inspect and parse it to get the method).

For sake of completeness and introspection, it could be useful to have access to them.

This patch adds Enumerator#receiver, #method and #arguments: http://github.com/marcandre/ruby/commit/fd4c17f7fd

Note that for Enumerator created with a block like Enumerator.new{|y| y << 1 << 2}, then receiver is a Enumerator::Generator, method is :each and arguments is []. This is consistent with inspect.

Thanks.
=end


Related issues 3 (0 open3 closed)

Related to Ruby master - Feature #3715: Enumerator#size and #size=Rejected08/19/2010Actions
Related to Ruby master - Feature #14044: Introduce a new attribute `step` in RangeRejectedmatz (Yukihiro Matsumoto)Actions
Has duplicate Ruby master - Feature #13904: getter for original information of EnumeratorClosedmrkn (Kenta Murata)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0