From: takashikkbn@... Date: 2017-05-25T15:37:24+00:00 Subject: [ruby-core:81383] [Ruby trunk Feature#8631] Add a new method to ERB to allow assigning the local variables from a hash Issue #8631 has been updated by k0kubun (Takashi Kokubun). I discussed about this with Seki-san. For name, I rethought that "result_with_locals" sounds to use caller's local variables. Since "result_with_hash" doesn't seem to mean it and is shorter, we agreed "result_with_hash" is the best. For receiver problem, since TOPLEVEL_BINDING.dup (and its receiver, main) is already used, we agreed it's consistent and safe to use TOPLEVEL_BINDING.dup. As Seki-san agreed to introduce this in person, I'm going to merge https://github.com/ruby/ruby/pull/1623. ---------------------------------------- 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-65091 * Author: rosenfeld (Rodrigo Rosenfeld Rosas) * Status: Feedback * 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: