diff options
| author | dearblue <[email protected]> | 2021-02-22 23:32:18 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2021-02-22 23:32:18 +0900 |
| commit | 792f6ac6700469ddf9be8f87ca3376082f9af7f3 (patch) | |
| tree | f04a5ffe00d4f442286a833b06d472941b20c93c /mrbgems/mruby-binding | |
| parent | 935ffa46a3a89a5f1662e5a4111ca0ed19566698 (diff) | |
| download | mruby-792f6ac6700469ddf9be8f87ca3376082f9af7f3.tar.gz mruby-792f6ac6700469ddf9be8f87ca3376082f9af7f3.zip | |
Adjustment of the current HEAD and bindings, and separation
Make changes to make `Binding` work.
At the same time, it separates `Binding#eval`, which depends on `mruby-eval`, from `mruby-binding-core`.
Diffstat (limited to 'mrbgems/mruby-binding')
| -rw-r--r-- | mrbgems/mruby-binding/mrbgem.rake | 8 | ||||
| -rw-r--r-- | mrbgems/mruby-binding/mrblib/binding.rb | 5 | ||||
| -rw-r--r-- | mrbgems/mruby-binding/test/binding.rb | 5 |
3 files changed, 18 insertions, 0 deletions
diff --git a/mrbgems/mruby-binding/mrbgem.rake b/mrbgems/mruby-binding/mrbgem.rake new file mode 100644 index 000000000..2701c506f --- /dev/null +++ b/mrbgems/mruby-binding/mrbgem.rake @@ -0,0 +1,8 @@ +MRuby::Gem::Specification.new('mruby-binding') do |spec| + spec.license = 'MIT' + spec.author = 'mruby developers' + spec.summary = 'Binding class' + + spec.add_dependency('mruby-binding-core', :core => 'mruby-binding-core') + spec.add_dependency('mruby-eval', :core => 'mruby-eval') +end diff --git a/mrbgems/mruby-binding/mrblib/binding.rb b/mrbgems/mruby-binding/mrblib/binding.rb new file mode 100644 index 000000000..b07480db1 --- /dev/null +++ b/mrbgems/mruby-binding/mrblib/binding.rb @@ -0,0 +1,5 @@ +class Binding + def eval(expr, *args) + Kernel.eval(expr, self, *args) + end +end diff --git a/mrbgems/mruby-binding/test/binding.rb b/mrbgems/mruby-binding/test/binding.rb new file mode 100644 index 000000000..73742400f --- /dev/null +++ b/mrbgems/mruby-binding/test/binding.rb @@ -0,0 +1,5 @@ +assert("Binding#eval") do + b = nil + 1.times { x, y, z = 1, 2, 3; [x,y,z]; b = binding } + assert_equal([1, 2, 3], b.eval("[x, y, z]")) +end |
