rdp-arguments 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/arguments/vm.rb +11 -3
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
|
2
|
+
|
1
3
|
== 0.4 2009-06-30
|
2
4
|
|
3
5
|
* 1 major enhancement:
|
@@ -20,3 +22,7 @@
|
|
20
22
|
* Method definition that uses splat operator is now ignored
|
21
23
|
* Last Hash argument is not used for assigning argument values if total number of arguments has been passed
|
22
24
|
* named_arguments_for can be called passing a Class method name eg: named_args_for :instance_method, 'self.class_method'
|
25
|
+
|
26
|
+
== 0.6.6 2010-01-27
|
27
|
+
|
28
|
+
* Speed up for 1.9 (ruby parser is slow)
|
data/lib/arguments/vm.rb
CHANGED
@@ -14,9 +14,17 @@ module Arguments
|
|
14
14
|
|
15
15
|
def self.ast_for_method klass, method, am_self
|
16
16
|
source, line = klass.instance_method(method).source_location
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
|
18
|
+
lines = IO.readlines( source )
|
19
|
+
|
20
|
+
remaining_lines = lines.length - line + 1 # 1 just in case...
|
21
|
+
# because rubyparser is so picky...
|
22
|
+
ast = nil
|
23
|
+
remaining_lines.times{|n|
|
24
|
+
str = lines[ (line-1)..(line + n) ].join
|
25
|
+
ast = PermissiveRubyParser.new.parse( str )
|
26
|
+
break if ast
|
27
|
+
}
|
20
28
|
if ast
|
21
29
|
if am_self
|
22
30
|
return (ast.assoc( :defs ) or ast)
|