dwml 1.0.0 → 1.1.0
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/lib/dwml/head_extractor.rb +18 -8
- data/lib/dwml/parameter_extractor.rb +10 -16
- data/lib/dwml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ad3fa1473b54cef4122ad9ff01aa394627674fa
|
4
|
+
data.tar.gz: 7599b77d6b7eb5861e8416dd6f3193747cb059a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be7c1920941e3d56fea05f7662b49e94ee728b39267c809527048b73a83ec2f0b4e2b556af8bad548ff5e3b655c08a58835e3201608be769a898ff7726ee3fe0
|
7
|
+
data.tar.gz: 69cc7789a51d860406c997e042feecec5c779798ab7a0e0c17af9012cba185fe5234354b64d4be2d44c7c55884e815f48fdf15d138bdb556e8b6812f2fbc9e99
|
data/lib/dwml/head_extractor.rb
CHANGED
@@ -20,9 +20,9 @@ class DWML
|
|
20
20
|
|
21
21
|
@output.merge!(
|
22
22
|
:product => {
|
23
|
-
:title =>
|
24
|
-
:field =>
|
25
|
-
:category =>
|
23
|
+
:title => normalize_content( 'product/title' ),
|
24
|
+
:field => normalize_content( 'product/field' ),
|
25
|
+
:category => normalize_content( 'product/category' ),
|
26
26
|
:creation_date => creation_date
|
27
27
|
}
|
28
28
|
)
|
@@ -34,14 +34,24 @@ class DWML
|
|
34
34
|
|
35
35
|
@output.merge!(
|
36
36
|
:source => {
|
37
|
-
:more_information => element.xpath('source/more-information').text,
|
38
37
|
:product_center => production_center.gsub(sub_center, " - #{sub_center}"),
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
38
|
+
:more_information => normalize_content( 'source/more-information' ),
|
39
|
+
:disclaimer => normalize_content( 'source/disclaimer' ),
|
40
|
+
:credit => normalize_content( 'source/credit' ),
|
41
|
+
:credit_logo => normalize_content( 'source/credit-logo' ),
|
42
|
+
:feedback => normalize_content( 'source/feedback' )
|
43
43
|
}
|
44
44
|
)
|
45
45
|
end
|
46
|
+
|
47
|
+
def normalize_content(selector)
|
48
|
+
node = element.xpath(selector)
|
49
|
+
|
50
|
+
if node.blank?
|
51
|
+
""
|
52
|
+
else
|
53
|
+
node.text
|
54
|
+
end
|
55
|
+
end
|
46
56
|
end
|
47
57
|
end
|
@@ -213,27 +213,21 @@ class DWML
|
|
213
213
|
value = condition.xpath("value").first
|
214
214
|
next if value.blank?
|
215
215
|
|
216
|
+
hsh = { :start_time => layout.valid_times[index].start }
|
217
|
+
|
216
218
|
visibility_node = value.xpath("visibility").first
|
217
|
-
|
218
|
-
|
219
|
+
if visibility_node.present? && visibility_node.text.present?
|
220
|
+
visibility = {
|
219
221
|
:unit => visibility_node.attributes["units"].text,
|
220
222
|
:value => visibility_node.text.to_f
|
221
223
|
}
|
222
|
-
|
223
|
-
|
224
|
-
end
|
225
|
-
|
226
|
-
hsh = {
|
227
|
-
:start_time => layout.valid_times[index].start,
|
228
|
-
:coverage => value.attributes["coverage"].text,
|
229
|
-
:intensity => value.attributes["intensity"].text,
|
230
|
-
:"weather-type" => value.attributes["weather-type"].text,
|
231
|
-
:qualifier => value.attributes["qualifier"].text,
|
232
|
-
:visibility => visibility
|
233
|
-
}
|
224
|
+
hsh.merge!( :visibility => visibility)
|
225
|
+
end
|
234
226
|
|
235
|
-
additive
|
236
|
-
|
227
|
+
[:coverage, :intensity, :additive, :qualifier, :"weather-type"].each do |key|
|
228
|
+
attribute = value.attributes[key.to_s]
|
229
|
+
hsh.merge!(key => attribute.to_s) if attribute.present?
|
230
|
+
end
|
237
231
|
|
238
232
|
@output[:weather][:conditions] << hsh
|
239
233
|
end
|
data/lib/dwml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angelo Lakra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|