railjet 2.0 → 2.1
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/Gemfile.lock +11 -11
- data/VERSION +1 -1
- data/lib/railjet/context.rb +1 -1
- data/lib/railjet/presenter.rb +84 -0
- data/lib/railjet/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98098fdd2ef601f2d4912de93a7b78eb67e1e9f1
|
4
|
+
data.tar.gz: 1993c032e26922585106c493cbeb94c90cc63996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4a02155ffe6ed9ef0425723b999ec1a24eba921445631f4bd1d49eddb5a5e9f4548f7af53ddd9363db16c3f584c73724ee01132452c9211d1e8e0d951ddb3e4
|
7
|
+
data.tar.gz: 5d6d60ef13cc80c2ac155ddc2f9fcdd8e086ca4c02d4e4a5655d8208a0a463dd0083ba059f54a449d78aa117d9c2e81b50d0290b40a6442a0d0de4cafa9f8b54
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
railjet (2.
|
4
|
+
railjet (2.1)
|
5
5
|
activemodel (> 4)
|
6
6
|
activesupport (> 4)
|
7
7
|
validates_timeliness (~> 4.0.2)
|
@@ -10,11 +10,11 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activemodel (5.
|
14
|
-
activesupport (= 5.
|
15
|
-
activesupport (5.
|
13
|
+
activemodel (5.2.3)
|
14
|
+
activesupport (= 5.2.3)
|
15
|
+
activesupport (5.2.3)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (
|
17
|
+
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
19
19
|
tzinfo (~> 1.1)
|
20
20
|
axiom-types (0.1.1)
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
coderay (1.1.2)
|
25
25
|
coercible (1.0.0)
|
26
26
|
descendants_tracker (~> 0.0.1)
|
27
|
-
concurrent-ruby (1.
|
27
|
+
concurrent-ruby (1.1.5)
|
28
28
|
descendants_tracker (0.0.4)
|
29
29
|
thread_safe (~> 0.3, >= 0.3.1)
|
30
30
|
diff-lcs (1.3)
|
@@ -38,11 +38,11 @@ GEM
|
|
38
38
|
netrc (>= 0.10.0, < 0.12.0.pre)
|
39
39
|
thor (>= 0.14.0, < 1.0.0.pre)
|
40
40
|
highline (1.7.8)
|
41
|
-
i18n (
|
41
|
+
i18n (1.6.0)
|
42
42
|
concurrent-ruby (~> 1.0)
|
43
43
|
ice_nine (0.11.2)
|
44
44
|
method_source (0.9.0)
|
45
|
-
minitest (5.
|
45
|
+
minitest (5.11.3)
|
46
46
|
multi_json (1.12.2)
|
47
47
|
multipart-post (2.0.0)
|
48
48
|
netrc (0.11.0)
|
@@ -67,8 +67,8 @@ GEM
|
|
67
67
|
rspec-support (3.6.0)
|
68
68
|
thor (0.20.0)
|
69
69
|
thread_safe (0.3.6)
|
70
|
-
timeliness (0.3.
|
71
|
-
tzinfo (1.2.
|
70
|
+
timeliness (0.3.10)
|
71
|
+
tzinfo (1.2.5)
|
72
72
|
thread_safe (~> 0.1)
|
73
73
|
validates_timeliness (4.0.2)
|
74
74
|
timeliness (~> 0.3.7)
|
@@ -91,4 +91,4 @@ DEPENDENCIES
|
|
91
91
|
rspec (~> 3.0)
|
92
92
|
|
93
93
|
BUNDLED WITH
|
94
|
-
1.
|
94
|
+
1.17.3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1
|
data/lib/railjet/context.rb
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module Railjet
|
4
|
+
module Presenter
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
def initialize(object)
|
8
|
+
@object = object
|
9
|
+
end
|
10
|
+
|
11
|
+
def as_json(*)
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def present_collection(objects)
|
17
|
+
objects.map { |o| new(o) }
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def present(name)
|
23
|
+
define_method(name) { instance_variable_get(:@object) }
|
24
|
+
private name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module WithContext
|
29
|
+
extend ActiveSupport::Concern
|
30
|
+
|
31
|
+
included do
|
32
|
+
attr_reader :context
|
33
|
+
private :context
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize(context, object)
|
37
|
+
@context = context
|
38
|
+
super(object)
|
39
|
+
end
|
40
|
+
|
41
|
+
module ClassMethods
|
42
|
+
def present_collection(context, objects)
|
43
|
+
objects.map { |o| new(context, o) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module Factory
|
48
|
+
extend ActiveSupport::Concern
|
49
|
+
|
50
|
+
module ClassMethods
|
51
|
+
def present_collection(context, objects)
|
52
|
+
objects.map { |o| present(context, o) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def present(context, object)
|
56
|
+
presenter_class(object).new(context, object)
|
57
|
+
end
|
58
|
+
|
59
|
+
def presenter_class(object)
|
60
|
+
raise NotImplementedError
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
module Factory
|
67
|
+
extend ActiveSupport::Concern
|
68
|
+
|
69
|
+
module ClassMethods
|
70
|
+
def present_collection(objects)
|
71
|
+
objects.map { |o| present(o) }
|
72
|
+
end
|
73
|
+
|
74
|
+
def present(object)
|
75
|
+
presenter_class(object).new(object)
|
76
|
+
end
|
77
|
+
|
78
|
+
def presenter_class(object)
|
79
|
+
raise NotImplementedError
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/railjet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railjet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Zalewski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/railjet/context.rb
|
186
186
|
- lib/railjet/form.rb
|
187
187
|
- lib/railjet/policy.rb
|
188
|
+
- lib/railjet/presenter.rb
|
188
189
|
- lib/railjet/repository.rb
|
189
190
|
- lib/railjet/repository/active_record.rb
|
190
191
|
- lib/railjet/repository/generic.rb
|
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
218
|
version: '0'
|
218
219
|
requirements: []
|
219
220
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
221
|
+
rubygems_version: 2.5.2
|
221
222
|
signing_key:
|
222
223
|
specification_version: 4
|
223
224
|
summary: Better architecture for high-speed railway
|