fleakr 0.6.1 → 0.6.2
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.
- data/README.rdoc +1 -0
- data/lib/fleakr/support/attribute.rb +6 -6
- data/lib/fleakr/version.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -408,6 +408,7 @@ in this project enough to contribute their ideas and code:
|
|
408
408
|
* {John Guenin}[http://github.com/johng]
|
409
409
|
* {Thomas Olausson}[http://github.com/latompa]
|
410
410
|
* {Robert Sköld}[http://github.com/slaskis]
|
411
|
+
* {Björn Wolf}[http://github.com/we5]
|
411
412
|
|
412
413
|
Thanks!
|
413
414
|
|
@@ -8,18 +8,18 @@ module Fleakr
|
|
8
8
|
|
9
9
|
def initialize(name, sources = nil)
|
10
10
|
@name = name.to_sym
|
11
|
-
|
11
|
+
|
12
12
|
@sources = Array(sources)
|
13
13
|
@sources << @name.to_s if @sources.empty?
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def split(source)
|
17
17
|
location, attribute = source.split('@')
|
18
18
|
location = self.name.to_s if location.blank?
|
19
|
-
|
19
|
+
|
20
20
|
[location, attribute]
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def node_for(document, source)
|
24
24
|
document.at(location(source)) || document.search("//[@#{attribute(source)}]").first
|
25
25
|
end
|
@@ -28,7 +28,7 @@ module Fleakr
|
|
28
28
|
location, attribute = source.split('@')
|
29
29
|
attribute || location
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def location(source)
|
33
33
|
split(source).first
|
34
34
|
end
|
@@ -36,7 +36,7 @@ module Fleakr
|
|
36
36
|
def value_from(document)
|
37
37
|
values = sources.map do |source|
|
38
38
|
node = node_for(document, source)
|
39
|
-
|
39
|
+
[node.attributes[attribute(source)], node.inner_text].reject{|v| v.blank?}.first unless node.nil?
|
40
40
|
end
|
41
41
|
values.compact.first
|
42
42
|
end
|
data/lib/fleakr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fleakr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Reagan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-06 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|