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.
Files changed (3) hide show
  1. data/History.txt +6 -0
  2. data/lib/arguments/vm.rb +11 -3
  3. metadata +1 -1
@@ -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)
@@ -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
- str = IO.readlines( source )[ (line-1)..-1 ].join
18
-
19
- ast = PermissiveRubyParser.new.parse( str )
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdp-arguments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Macario Ortega, rogerdpack