genki-methopara 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +6 -4
- data/ext/methopara.c +59 -56
- metadata +7 -7
data/Rakefile
CHANGED
@@ -14,11 +14,11 @@ NAME = "methopara"
|
|
14
14
|
AUTHORS = ["Koichi Sasada", "Genki Takiuchi"]
|
15
15
|
EMAIL = "genki@s21g.com"
|
16
16
|
DESCRIPTION = "Method#parameters for ruby-1.9.1"
|
17
|
-
RUBYFORGE_PROJECT = "
|
17
|
+
RUBYFORGE_PROJECT = "asakusarb"
|
18
18
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
19
19
|
BIN_FILES = %w( )
|
20
20
|
|
21
|
-
VERS = "0.3.
|
21
|
+
VERS = "0.3.2"
|
22
22
|
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
23
23
|
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
24
24
|
RDOC_OPTS = [
|
@@ -59,7 +59,7 @@ spec = Gem::Specification.new do |s|
|
|
59
59
|
s.test_files = Dir["test/*_test.rb"]
|
60
60
|
|
61
61
|
#s.add_dependency('activesupport', '>=1.3.1')
|
62
|
-
s.required_ruby_version = '
|
62
|
+
s.required_ruby_version = '~> 1.9.1'
|
63
63
|
|
64
64
|
s.files = %w(README ChangeLog Rakefile) +
|
65
65
|
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
@@ -139,5 +139,7 @@ end
|
|
139
139
|
|
140
140
|
desc 'Update gem spec'
|
141
141
|
task :gemspec do
|
142
|
-
open("#{NAME}.gemspec", 'w')
|
142
|
+
open("#{NAME}.gemspec", 'w') do |file|
|
143
|
+
file.write spec.to_ruby
|
144
|
+
end
|
143
145
|
end
|
data/ext/methopara.c
CHANGED
@@ -13,25 +13,25 @@ typedef struct RNode {
|
|
13
13
|
unsigned long flags;
|
14
14
|
char *nd_file;
|
15
15
|
union {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
struct RNode *node;
|
17
|
+
ID id;
|
18
|
+
VALUE value;
|
19
|
+
VALUE (*cfunc)(ANYARGS);
|
20
|
+
ID *tbl;
|
21
21
|
} u1;
|
22
22
|
union {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
struct RNode *node;
|
24
|
+
ID id;
|
25
|
+
long argc;
|
26
|
+
VALUE value;
|
27
27
|
} u2;
|
28
28
|
union {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
struct RNode *node;
|
30
|
+
ID id;
|
31
|
+
long state;
|
32
|
+
struct global_entry *entry;
|
33
|
+
long cnt;
|
34
|
+
VALUE value;
|
35
35
|
} u3;
|
36
36
|
} NODE;
|
37
37
|
|
@@ -385,50 +385,52 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
|
|
385
385
|
CONST_ID(req, "req");
|
386
386
|
CONST_ID(opt, "opt");
|
387
387
|
if (is_proc) {
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
388
|
+
for (i = 0; i < iseq->argc; i++) {
|
389
|
+
PARAM_TYPE(opt);
|
390
|
+
rb_ary_push(a, rb_id2name(PARAM_ID(i)) ?
|
391
|
+
ID2SYM(PARAM_ID(i)) : Qnil);
|
392
|
+
rb_ary_push(a, Qnil);
|
393
|
+
rb_ary_push(args, a);
|
394
|
+
}
|
394
395
|
}
|
395
396
|
else {
|
396
|
-
|
397
|
-
|
398
|
-
|
397
|
+
for (i = 0; i < iseq->argc; i++) {
|
398
|
+
rb_ary_push(args, PARAM(i, req));
|
399
|
+
}
|
399
400
|
}
|
400
401
|
r = iseq->arg_rest != -1 ? iseq->arg_rest :
|
401
|
-
|
402
|
-
|
403
|
-
|
402
|
+
iseq->arg_post_len > 0 ? iseq->arg_post_start :
|
403
|
+
iseq->arg_block != -1 ? iseq->arg_block :
|
404
|
+
iseq->arg_size;
|
404
405
|
for (s = i; i < r; i++) {
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
406
|
+
PARAM_TYPE(opt);
|
407
|
+
if (rb_id2name(PARAM_ID(i))) {
|
408
|
+
rb_ary_push(a, ID2SYM(PARAM_ID(i)));
|
409
|
+
}
|
410
|
+
rb_ary_push(args, a);
|
410
411
|
}
|
411
412
|
if (iseq->arg_rest != -1) {
|
412
|
-
|
413
|
-
|
413
|
+
CONST_ID(rest, "rest");
|
414
|
+
rb_ary_push(args, PARAM(iseq->arg_rest, rest));
|
414
415
|
}
|
415
416
|
r = iseq->arg_post_start + iseq->arg_post_len;
|
416
417
|
if (is_proc) {
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
418
|
+
for (i = iseq->arg_post_start; i < r; i++) {
|
419
|
+
PARAM_TYPE(opt);
|
420
|
+
rb_ary_push(a, rb_id2name(PARAM_ID(i)) ?
|
421
|
+
ID2SYM(PARAM_ID(i)) : Qnil);
|
422
|
+
rb_ary_push(a, Qnil);
|
423
|
+
rb_ary_push(args, a);
|
424
|
+
}
|
423
425
|
}
|
424
426
|
else {
|
425
|
-
|
426
|
-
|
427
|
-
|
427
|
+
for (i = iseq->arg_post_start; i < r; i++) {
|
428
|
+
rb_ary_push(args, PARAM(i, req));
|
429
|
+
}
|
428
430
|
}
|
429
431
|
if (iseq->arg_block != -1) {
|
430
|
-
|
431
|
-
|
432
|
+
CONST_ID(block, "block");
|
433
|
+
rb_ary_push(args, PARAM(iseq->arg_block, block));
|
432
434
|
}
|
433
435
|
return args;
|
434
436
|
}
|
@@ -443,13 +445,13 @@ get_method_iseq(VALUE method)
|
|
443
445
|
Data_Get_Struct(method, struct METHOD, data);
|
444
446
|
body = data->body;
|
445
447
|
switch (nd_type(body)) {
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
448
|
+
case NODE_BMETHOD:
|
449
|
+
rb_notimplement();
|
450
|
+
case RUBY_VM_METHOD_NODE:
|
451
|
+
GetISeqPtr((VALUE)body->nd_body, iseq);
|
452
|
+
if (RUBY_VM_NORMAL_ISEQ_P(iseq)) break;
|
453
|
+
default:
|
454
|
+
return 0;
|
453
455
|
}
|
454
456
|
return iseq;
|
455
457
|
}
|
@@ -464,11 +466,11 @@ unnamed_parameters(int arity)
|
|
464
466
|
a = rb_ary_new3(1, ID2SYM(req));
|
465
467
|
OBJ_FREEZE(a);
|
466
468
|
for (; n; --n) {
|
467
|
-
|
469
|
+
rb_ary_push(param, a);
|
468
470
|
}
|
469
471
|
if (arity < 0) {
|
470
|
-
|
471
|
-
|
472
|
+
CONST_ID(rest, "rest");
|
473
|
+
rb_ary_store(param, ~arity, rb_ary_new3(1, ID2SYM(rest)));
|
472
474
|
}
|
473
475
|
return param;
|
474
476
|
}
|
@@ -485,7 +487,8 @@ rb_method_parameters(VALUE method)
|
|
485
487
|
{
|
486
488
|
rb_iseq_t *iseq = get_method_iseq(method);
|
487
489
|
if (!iseq) {
|
488
|
-
|
490
|
+
return unnamed_parameters(
|
491
|
+
FIX2INT(rb_funcall(method, rb_intern("arity"), 0)));
|
489
492
|
}
|
490
493
|
return rb_iseq_parameters(iseq, 0);
|
491
494
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genki-methopara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi Sasada
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-06-06 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -30,8 +30,8 @@ files:
|
|
30
30
|
- lib/methopara.rb
|
31
31
|
- ext/methopara.c
|
32
32
|
- ext/extconf.rb
|
33
|
-
has_rdoc:
|
34
|
-
homepage: http://
|
33
|
+
has_rdoc: false
|
34
|
+
homepage: http://asakusarb.rubyforge.org
|
35
35
|
post_install_message:
|
36
36
|
rdoc_options:
|
37
37
|
- --title
|
@@ -50,7 +50,7 @@ require_paths:
|
|
50
50
|
- lib
|
51
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.9.1
|
56
56
|
version:
|
@@ -62,10 +62,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version:
|
63
63
|
requirements: []
|
64
64
|
|
65
|
-
rubyforge_project:
|
65
|
+
rubyforge_project: asakusarb
|
66
66
|
rubygems_version: 1.2.0
|
67
67
|
signing_key:
|
68
|
-
specification_version:
|
68
|
+
specification_version: 3
|
69
69
|
summary: Method#parameters for ruby-1.9.1
|
70
70
|
test_files: []
|
71
71
|
|