sexp_processor 4.5.0 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b1a7852e40b91a5630473ef5ad0cb8ceee59926
4
- data.tar.gz: 90ca1ab651c1a308f53c7f2e828d16bb43b43e4a
3
+ metadata.gz: 62c0aa828d8f1248831b41b55c5e98d555f78d72
4
+ data.tar.gz: 8400a9eea896d3abe596824d0d4bbd032b1aeb84
5
5
  SHA512:
6
- metadata.gz: df558f45a1c985550f2ac4910132b7f2a171e7db4252b3ca62d6f19ec871be46108874238b660eb0231a9f80ed275df3436ce611f55058310a9686de02a6f518
7
- data.tar.gz: 07f4d089f5fb5f8bab28f8c96fb7b614decb8a94f3a7a18ae76607794c2498658838fb59d9d99acfc61c10e0f196512bb1f02fc9898666cac8d3eb5b4cc2faf5
6
+ metadata.gz: 43948ed14ddf302790cc948f6c6587cfe8dd51a80eede842c1d3fae7305a3263fde9ee88c9bbebf3f701eed20c6c83c5ff06d7f5105156f943afa522bfe9dbee
7
+ data.tar.gz: bc347b20545780e71531eb702d215a83eff13b7aeb8149e6dc62e2716db4ea8b7f16886ca6c73dcef1b773201b1e159d7f9ca0f957b9504408f7dad6ffae9e86
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 4.5.1 / 2015-04-27
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Cache processors and rewriters. Significant speedup. (presidentbeef)
6
+
1
7
  === 4.5.0 / 2015-03-09
2
8
 
3
9
  * 1 minor enhancement:
@@ -33,7 +33,7 @@ require 'sexp'
33
33
 
34
34
  class SexpProcessor
35
35
 
36
- VERSION = "4.5.0"
36
+ VERSION = "4.5.1"
37
37
 
38
38
  ##
39
39
  # Automatically shifts off the Sexp type before handing the
@@ -109,6 +109,20 @@ class SexpProcessor
109
109
  }.flatten.sort
110
110
  end
111
111
 
112
+ ##
113
+ # Cache processor methods per class.
114
+
115
+ def self.processors
116
+ @processors ||= {}
117
+ end
118
+
119
+ ##
120
+ # Cache rewiter methods per class.
121
+
122
+ def self.rewriters
123
+ @rewriters ||= {}
124
+ end
125
+
112
126
  ##
113
127
  # Creates a new SexpProcessor. Use super to invoke this
114
128
  # initializer from SexpProcessor subclasses, then use the
@@ -130,16 +144,18 @@ class SexpProcessor
130
144
 
131
145
  # we do this on an instance basis so we can subclass it for
132
146
  # different processors.
133
- @processors = {}
134
- @rewriters = {}
147
+ @processors = self.class.processors
148
+ @rewriters = self.class.rewriters
135
149
  @context = []
136
150
 
137
- public_methods.each do |name|
138
- case name
139
- when /^process_(.*)/ then
140
- @processors[$1.to_sym] = name.to_sym
141
- when /^rewrite_(.*)/ then
142
- @rewriters[$1.to_sym] = name.to_sym
151
+ if @processors.empty?
152
+ public_methods.each do |name|
153
+ case name
154
+ when /^process_(.*)/ then
155
+ @processors[$1.to_sym] = name.to_sym
156
+ when /^rewrite_(.*)/ then
157
+ @rewriters[$1.to_sym] = name.to_sym
158
+ end
143
159
  end
144
160
  end
145
161
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sexp_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
30
30
  VpzF30vNaJK6ZT7xlIsIlwmH
31
31
  -----END CERTIFICATE-----
32
- date: 2015-03-09 00:00:00.000000000 Z
32
+ date: 2015-04-27 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: minitest
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '5.5'
40
+ version: '5.6'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '5.5'
47
+ version: '5.6'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rdoc
50
50
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file