structurebutcher 0.7.0 → 0.8.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/structurebutcher.rb +15 -2
- 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: db853d50c1ba07f0bc5a4e4d990c4586b4ba17d5
|
4
|
+
data.tar.gz: 337b870faf1fad12a15767be0b246958286442da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b694dce96c8783c94d473fdb581f56b504c4d181985e0bfcf7061cb7b7f5eb5eaad9f1c6f0a627c2a3d9a1f7d09c11647a35c5a1de8a07d43262bcb93af3ee0e
|
7
|
+
data.tar.gz: 592094360fa418d177bc3e7dbede2832978d16cfa8a17cbfdd07f740e62e472b611d9b5b8a45852125fc2a249814408224178b44d0ca1c043f25957dd2d256b7
|
data/lib/structurebutcher.rb
CHANGED
@@ -10,6 +10,18 @@ require 'base64'
|
|
10
10
|
#amputovat, implantovat
|
11
11
|
#amputate, implantate
|
12
12
|
|
13
|
+
class Hash
|
14
|
+
def sort_by_key(recursive = false, &block)
|
15
|
+
self.keys.sort(&block).reduce({}) do |seed, key|
|
16
|
+
seed[key] = self[key]
|
17
|
+
if recursive && seed[key].is_a?(Hash)
|
18
|
+
seed[key] = seed[key].sort_by_key(true, &block)
|
19
|
+
end
|
20
|
+
seed
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
13
25
|
class StructureButcher
|
14
26
|
def split_escape(str)
|
15
27
|
output = []
|
@@ -72,7 +84,8 @@ class StructureButcher
|
|
72
84
|
part = butcher.implantate(body, slot, part)
|
73
85
|
|
74
86
|
storer = StructureButcher::Storer.new
|
75
|
-
|
87
|
+
|
88
|
+
storer.save_structure(body.sort_by_key(true), body_file, "yaml")
|
76
89
|
end
|
77
90
|
|
78
91
|
def implantate_struct_into_file(body_file, slot, part_struct)
|
@@ -89,7 +102,7 @@ class StructureButcher
|
|
89
102
|
butcher.implantate(body, slot, part_struct)
|
90
103
|
|
91
104
|
storer = StructureButcher::Storer.new
|
92
|
-
storer.save_structure(body, body_file, "yaml")
|
105
|
+
storer.save_structure(body.sort_by_key(true), body_file, "yaml")
|
93
106
|
end
|
94
107
|
end
|
95
108
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structurebutcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miroslav Tynovsky
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.8
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Config saver/restorer
|