hudson-to-pisswhistle 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hudson_to_pisswhistle.rb +11 -4
- metadata +5 -5
@@ -5,10 +5,17 @@ require 'json'
|
|
5
5
|
|
6
6
|
class HudsonToPissWhistle
|
7
7
|
# Hudson's XML keys contain dots, but BSON doesn't like that.
|
8
|
-
def self.change_dots_to_hyphens_in_keys(
|
9
|
-
|
10
|
-
|
11
|
-
h
|
8
|
+
def self.change_dots_to_hyphens_in_keys(hash_or_array)
|
9
|
+
case hash_or_array
|
10
|
+
when Hash
|
11
|
+
hash_or_array.inject({}) do |h, (k,v)|
|
12
|
+
h[k.to_s.gsub(".", "-")] = change_dots_to_hyphens_in_keys(v)
|
13
|
+
h
|
14
|
+
end
|
15
|
+
when Array
|
16
|
+
hash_or_array.map { |value| change_dots_to_hyphens_in_keys(value) }
|
17
|
+
else
|
18
|
+
hash_or_array
|
12
19
|
end
|
13
20
|
end
|
14
21
|
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hudson-to-pisswhistle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- James Adam
|
13
|
+
- James Adam, James Mead
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-10 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|