separatum 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/separatum/converters/object2_hash.rb +1 -1
- data/lib/separatum/exporters/active_record_code.rb +1 -0
- data/lib/separatum/importers/active_record.rb +2 -1
- data/lib/separatum/processors/time_machine.rb +29 -0
- data/lib/separatum/version.rb +1 -1
- data/separatum.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b6bf95f4501924e1ab4760ebfe7825690d97f09f7ccbb216017d676002147f6
|
4
|
+
data.tar.gz: c0eec7ae938a642567a192ad19a806543c7289c05478a96135cf7c1ab74823e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbf04c68a0943f34514210a3868450934c6a0ff6c702285776ef0aecb3a40d9ff2b4f110fe48a9ba7f52376da70dc91af973af1e3965043a82c150a7ef8bac8
|
7
|
+
data.tar.gz: 649d55918b9c1791db07f419e04a750c18c26bdd68569ed50b413f17fb14020ff19fa4dc9f76fcce725ff76a7ee620b87825e1787ab92461e37a755b30efef61
|
@@ -17,6 +17,7 @@ module Separatum
|
|
17
17
|
@klass_transitions = Set[]
|
18
18
|
@object_transitions = Set[]
|
19
19
|
@objects = Set[]
|
20
|
+
@time_machine = Time.now
|
20
21
|
end
|
21
22
|
|
22
23
|
def call(*objects)
|
@@ -35,7 +36,7 @@ module Separatum
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
::Separatum::Converters::Object2Hash.new.(result.flatten.uniq)
|
39
|
+
::Separatum::Converters::Object2Hash.new(common_fields: { _time_machine: @time_machine }).(result.flatten.uniq)
|
39
40
|
end
|
40
41
|
|
41
42
|
def act(object, depth = 1)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
module Separatum
|
4
|
+
module Processors
|
5
|
+
class TimeMachine
|
6
|
+
def call(*hashes)
|
7
|
+
time_current = Time.now
|
8
|
+
hashes.flatten.map do |hash|
|
9
|
+
if hash.key?(:_time_machine)
|
10
|
+
time_offset = time_current - Time.parse(hash[:_time_machine])
|
11
|
+
new_hash = {}
|
12
|
+
hash.each do |k, v|
|
13
|
+
if k == :_time_machine
|
14
|
+
next
|
15
|
+
elsif (time = (Time.parse(v) rescue nil))
|
16
|
+
new_hash[k] = (time + time_offset).to_s
|
17
|
+
else
|
18
|
+
new_hash[k] = v
|
19
|
+
end
|
20
|
+
end
|
21
|
+
new_hash
|
22
|
+
else
|
23
|
+
hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/separatum/version.rb
CHANGED
data/separatum.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: separatum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Osenenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: timecop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.9'
|
55
69
|
description:
|
56
70
|
email:
|
57
71
|
executables: []
|
@@ -85,6 +99,7 @@ files:
|
|
85
99
|
- lib/separatum/importers/json_file.rb
|
86
100
|
- lib/separatum/processors/field_changer.rb
|
87
101
|
- lib/separatum/processors/inspect.rb
|
102
|
+
- lib/separatum/processors/time_machine.rb
|
88
103
|
- lib/separatum/processors/uuid_changer.rb
|
89
104
|
- lib/separatum/version.rb
|
90
105
|
- separatum.gemspec
|