[#79440] [Ruby trunk Bug#13188] Reinitialize Ruby VM. — shyouhei@...
Issue #13188 has been updated by Shyouhei Urabe.
6 messages
2017/02/06
[#79441] Re: [Ruby trunk Bug#13188] Reinitialize Ruby VM.
— SASADA Koichi <ko1@...>
2017/02/06
On 2017/02/06 10:10, shyouhei@ruby-lang.org wrote:
[#79532] Immutable Strings vs Symbols — Daniel Ferreira <subtileos@...>
Hi,
15 messages
2017/02/15
[#79541] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/15
Em 15-02-2017 05:05, Daniel Ferreira escreveu:
[#79543] Re: Immutable Strings vs Symbols
— Daniel Ferreira <subtileos@...>
2017/02/16
Hi Rodrigo,
[#79560] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/16
Em 15-02-2017 22:39, Daniel Ferreira escreveu:
[ruby-core:79449] [CommonRuby Feature#8643][Feedback] Add Binding.from_hash
From:
ko1@...
Date:
2017-02-06 03:29:34 UTC
List:
ruby-core #79449
Issue #8643 has been updated by Koichi Sasada.
Status changed from Open to Feedback
Can I close this issue?
----------------------------------------
Feature #8643: Add Binding.from_hash
https://bugs.ruby-lang.org/issues/8643#change-62881
* Author: Rodrigo Rosenfeld Rosas
* Status: Feedback
* Priority: Normal
* Assignee: Koichi Sasada
* Target version:
----------------------------------------
`Binding.from_hash` would work like:
```ruby
class Binding
def self.from_hash(hash)
OpenStruct.new(hash){ binding }
end
end
```
It would simplify things like:
`ERB.new(IO.read 'template.erb').result Binding.from_hash(template_local: 'example')`
Or if you need to `eval` some code in another process (JRuby, for instance) and need to pass some arguments to the `eval` code in a hash form.
I didn't want to pollute `Hash` by adding `Hash#to_binding`. I believe `Binding.from_hash` is more appropriate.
---Files--------------------------------
feature-8643.pdf (19 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>