Issue #8631 has been updated by k0kubun (Takashi Kokubun).


There's a problem that a receiver is unclear and not configurable if argument is only a Hash object. To address the problem, we need to have both anything for a receiver (of course Binding is okay) and a Hash object in arguments.

Even in that case, most users of this feature will want to pass only a Hash object as argument. So we want to pass a Hash object with default option for its receiver, without breaking backward compatibility.

To solve all those problems, I propose to use keyword argument like https://github.com/ruby/ruby/pull/1618.

----------------------------------------
Feature #8631: Add a new method to ERB to allow assigning the local variables from a hash
https://bugs.ruby-lang.org/issues/8631#change-64879

* Author: rosenfeld (Rodrigo Rosenfeld Rosas)
* Status: Assigned
* Priority: Normal
* Assignee: k0kubun (Takashi Kokubun)
* Target version: 2.5
----------------------------------------
It would be interesting if ERB could allow a hash instead of a binding for processing the template.

We wouldn't have to do hacks like:

b = OpenStruct.new(hash).instance_eval{ binding }


---Files--------------------------------
feature-8631.pdf (27.7 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>