oga 1.3.0-java → 1.3.1-java
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.
- checksums.yaml +4 -4
- data/README.md +10 -6
- data/lib/liboga.jar +0 -0
- data/lib/oga.rb +1 -0
- data/lib/oga/version.rb +1 -1
- data/lib/oga/xpath/compiler.rb +6 -1
- data/lib/oga/xpath/context.rb +17 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3608b688e55076f115741bdb807801c071e30e60
|
4
|
+
data.tar.gz: 11f53bdfb9476c8f4fc1bb34d87492a735558924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3a13a06251539d4d9d16ea8095529606fb6d7a727c49ff8487c15bd62ee4233343e4ef8da5fd11323057607ad18421f8327830d36703b7575311217156625e
|
7
|
+
data.tar.gz: 6156e9bd4ec21b89974cf1e40406938164028c95aeac63207dffe48edbd3689bf3411cd3877e385fb7b38c790676b105c838db6e9eac8b614ae7cc1837b77561
|
data/README.md
CHANGED
@@ -177,13 +177,17 @@ process and bundled inside the Gem itself.
|
|
177
177
|
|
178
178
|
## Thread Safety
|
179
179
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
180
|
+
Oga does not use a unsynchronized global mutable state. As a result of this you
|
181
|
+
can parse/create documents concurrently without any problems. Modifying
|
182
|
+
documents concurrently can lead to bugs as these operations are not
|
183
|
+
synchronized.
|
184
184
|
|
185
|
-
|
186
|
-
|
185
|
+
Some querying operations will cache data in instance variables, without
|
186
|
+
synchronization. An example is `Oga::XML::Element#namespace` which will cache an
|
187
|
+
element's namespace after the first call.
|
188
|
+
|
189
|
+
In general it's recommended to _not_ use the same document in multiple threads
|
190
|
+
at the same time.
|
187
191
|
|
188
192
|
## Namespace Support
|
189
193
|
|
data/lib/liboga.jar
CHANGED
Binary file
|
data/lib/oga.rb
CHANGED
data/lib/oga/version.rb
CHANGED
data/lib/oga/xpath/compiler.rb
CHANGED
@@ -12,6 +12,11 @@ module Oga
|
|
12
12
|
# @return [Oga::LRU]
|
13
13
|
CACHE = LRU.new
|
14
14
|
|
15
|
+
# Context for compiled Procs. As compiled Procs do not mutate the
|
16
|
+
# enclosing environment we can just re-use the same instance without
|
17
|
+
# synchronization.
|
18
|
+
CONTEXT = Context.new
|
19
|
+
|
15
20
|
# Wildcard for node names/namespace prefixes.
|
16
21
|
STAR = '*'
|
17
22
|
|
@@ -86,7 +91,7 @@ module Oga
|
|
86
91
|
generator = Ruby::Generator.new
|
87
92
|
source = generator.process(proc_ast)
|
88
93
|
|
89
|
-
|
94
|
+
CONTEXT.evaluate(source)
|
90
95
|
ensure
|
91
96
|
reset
|
92
97
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Oga
|
2
|
+
module XPath
|
3
|
+
# Class used as the context for compiled XPath Procs.
|
4
|
+
#
|
5
|
+
# The binding of this class is used for the binding of Procs compiled by
|
6
|
+
# {Compiler}. Not using a specific binding would result in the procs
|
7
|
+
# using the binding of {Compiler#compile}, which could lead to race
|
8
|
+
# conditions.
|
9
|
+
class Context
|
10
|
+
# @param [String] string
|
11
|
+
# @return [Proc]
|
12
|
+
def evaluate(string)
|
13
|
+
binding.eval(string)
|
14
|
+
end
|
15
|
+
end # Context
|
16
|
+
end # XPath
|
17
|
+
end # Oga
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Yorick Peterse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- lib/oga/xml/traversal.rb
|
200
200
|
- lib/oga/xml/xml_declaration.rb
|
201
201
|
- lib/oga/xpath/compiler.rb
|
202
|
+
- lib/oga/xpath/context.rb
|
202
203
|
- lib/oga/xpath/conversion.rb
|
203
204
|
- lib/oga/xpath/lexer.rb
|
204
205
|
- lib/oga/xpath/parser.rb
|