rscript 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rscript.rb +7 -3
  2. metadata +1 -1
data/lib/rscript.rb CHANGED
@@ -22,11 +22,12 @@
22
22
 
23
23
 
24
24
  require 'rscript_base'
25
+ require 'hashcache'
25
26
 
26
27
  class RScript < RScriptBase
27
28
 
28
29
  def initialize()
29
-
30
+ @rsf_cache = HashCache.new(cache: 5)
30
31
  end
31
32
 
32
33
  def read(args=[])
@@ -56,6 +57,9 @@ class RScript < RScriptBase
56
57
  [out, args]
57
58
  end
58
59
 
60
+ def reset()
61
+ @rsf_cache.reset
62
+ end
59
63
 
60
64
  private
61
65
 
@@ -65,7 +69,7 @@ class RScript < RScriptBase
65
69
  $rsfile = rsfile[/[a-zA-z0-9]+(?=\.rsf)/]
66
70
 
67
71
  @url_base = rsfile[/\w+:\/\/[^\/]+/]
68
- buffer = read_sourcecode(rsfile)
72
+ buffer = @rsf_cache.read(rsfile) {read_sourcecode(rsfile) }
69
73
 
70
74
  doc = Document.new(buffer)
71
75
  yield(doc)
@@ -77,7 +81,7 @@ class RScript < RScriptBase
77
81
  rsfile = args[0]; args.shift
78
82
 
79
83
  $rsfile = rsfile[/[a-zA-z0-9]+(?=\.rsf)/]
80
- buffer = read_sourcecode(rsfile)
84
+ buffer = @rsf_cache.read(rsfile) {read_sourcecode(rsfile) }
81
85
  @url_base = rsfile[/\w+:\/\/[^\/]+/]
82
86
  doc = Document.new(buffer)
83
87
  yield(doc)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rscript
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.10
5
+ version: 0.1.11
6
6
  platform: ruby
7
7
  authors: []
8
8