summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
authorJared Breeden <[email protected]>2015-06-22 23:20:24 -0700
committerJared Breeden <[email protected]>2015-06-22 23:20:24 -0700
commit18337266f838003d631d2c02e6d847ae5375a839 (patch)
treeccf038939213da30b99ba8931d87bc0d719dbc8a /mrbgems
parent9781580c7134fcee7bf5a6d4356bc47593549da8 (diff)
parent1001be2e99720f6745159295aa73c649e08adec8 (diff)
downloadmruby-18337266f838003d631d2c02e6d847ae5375a839.tar.gz
mruby-18337266f838003d631d2c02e6d847ae5375a839.zip
Merge branch 'master' of http://github.com/mruby/mruby into alloc_doc
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/default.gembox3
-rw-r--r--mrbgems/mruby-bin-mirb/mrbgem.rake1
-rw-r--r--mrbgems/mruby-bin-mruby/mrbgem.rake1
-rw-r--r--mrbgems/mruby-proc-ext/mrblib/proc.rb4
-rw-r--r--mrbgems/mruby-proc-ext/test/proc.rb3
5 files changed, 11 insertions, 1 deletions
diff --git a/mrbgems/default.gembox b/mrbgems/default.gembox
index 06609d9e7..30dcc1abc 100644
--- a/mrbgems/default.gembox
+++ b/mrbgems/default.gembox
@@ -70,4 +70,7 @@ MRuby::GemBox.new do |conf|
# Use extensional Kernel module
conf.gem :core => "mruby-kernel-ext"
+
+ # Use mruby-compiler to build other mrbgems
+ conf.gem :core => "mruby-compiler"
end
diff --git a/mrbgems/mruby-bin-mirb/mrbgem.rake b/mrbgems/mruby-bin-mirb/mrbgem.rake
index dce832d98..7d45409c9 100644
--- a/mrbgems/mruby-bin-mirb/mrbgem.rake
+++ b/mrbgems/mruby-bin-mirb/mrbgem.rake
@@ -26,4 +26,5 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec|
end
spec.bins = %w(mirb)
+ spec.add_dependency('mruby-compiler', :core => 'mruby-compiler')
end
diff --git a/mrbgems/mruby-bin-mruby/mrbgem.rake b/mrbgems/mruby-bin-mruby/mrbgem.rake
index 4e2f6a142..ba7fad1fa 100644
--- a/mrbgems/mruby-bin-mruby/mrbgem.rake
+++ b/mrbgems/mruby-bin-mruby/mrbgem.rake
@@ -3,4 +3,5 @@ MRuby::Gem::Specification.new('mruby-bin-mruby') do |spec|
spec.author = 'mruby developers'
spec.summary = 'mruby command'
spec.bins = %w(mruby)
+ spec.add_dependency('mruby-compiler', :core => 'mruby-compiler')
end
diff --git a/mrbgems/mruby-proc-ext/mrblib/proc.rb b/mrbgems/mruby-proc-ext/mrblib/proc.rb
index 5dd9981df..b71663938 100644
--- a/mrbgems/mruby-proc-ext/mrblib/proc.rb
+++ b/mrbgems/mruby-proc-ext/mrblib/proc.rb
@@ -13,9 +13,11 @@ class Proc
end
def curry(arity=self.arity)
+ type = :proc
abs = lambda {|a| a < 0 ? -a - 1 : a}
arity = abs[arity]
if lambda?
+ type = :lambda
self_arity = self.arity
if (self_arity >= 0 && arity != self_arity) ||
(self_arity < 0 && abs[self_arity] > arity)
@@ -25,7 +27,7 @@ class Proc
pproc = self
make_curry = proc do |given_args=[]|
- proc do |*args|
+ send(type) do |*args|
new_args = given_args + args
if new_args.size >= arity
pproc[*new_args]
diff --git a/mrbgems/mruby-proc-ext/test/proc.rb b/mrbgems/mruby-proc-ext/test/proc.rb
index bca9b463a..75e11dd93 100644
--- a/mrbgems/mruby-proc-ext/test/proc.rb
+++ b/mrbgems/mruby-proc-ext/test/proc.rb
@@ -41,6 +41,9 @@ assert('Proc#curry') do
assert_raise(ArgumentError) { b.curry[1, 2][3, 4] }
assert_raise(ArgumentError) { b.curry(5) }
assert_raise(ArgumentError) { b.curry(1) }
+
+ assert_false(proc{}.curry.lambda?)
+ assert_true(lambda{}.curry.lambda?)
end
assert('Proc#parameters') do