railjet 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/VERSION +1 -1
- data/lib/railjet.rb +1 -0
- data/lib/railjet/presenter.rb +18 -6
- data/lib/railjet/presenter_context.rb +14 -0
- data/lib/railjet/version.rb +1 -1
- metadata +3 -3
- data/.travis.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '098b90a736eae576e53de9bfc06a8cdc300d804d'
|
4
|
+
data.tar.gz: f31c69ff62c11c2c66833e90c91ab48f86e1bb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71fe9cedb8d2362c93890527ab124e4c3c51c893d3708a6d3b4a10464b2620a871d05ec4a4e443b4b90e0e1751a9980d1414a078ae2fac31b0323a64e1b7c200
|
7
|
+
data.tar.gz: d53d4a1837cee25e3444c6e600bc3c454e520f11679b17e2d71ee784e83bb78d9993a3dab456c23b1ca790a6c1b1635312ae8b18284ef5153115592c9dcbfb62
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Railjet, architecture for high-speed railway [![Build Status](https://
|
1
|
+
# Railjet, architecture for high-speed railway [![Build Status](https://semaphoreci.com/api/v1/nedap/railjet/branches/master/badge.svg)](https://semaphoreci.com/nedap/railjet)
|
2
|
+
|
2
3
|
|
3
4
|
![Railjet](https://www.swisspasses.com/railpass/popup/railjet/slideshow/RailJet-Zuerich-St.-Anton-Transfer-Ticket-from-Swisspasses.com.jpg)
|
4
5
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/lib/railjet.rb
CHANGED
data/lib/railjet/presenter.rb
CHANGED
@@ -8,25 +8,29 @@ module Railjet
|
|
8
8
|
@object = object
|
9
9
|
end
|
10
10
|
|
11
|
+
attr_reader :object
|
12
|
+
|
11
13
|
def as_json(*)
|
12
14
|
raise NotImplementedError
|
13
15
|
end
|
14
16
|
|
15
17
|
module ClassMethods
|
16
18
|
def present_collection(objects)
|
17
|
-
objects.map { |o|
|
19
|
+
objects.map { |o| present(o) }
|
18
20
|
end
|
19
21
|
|
20
|
-
|
22
|
+
def present(object)
|
23
|
+
new(object)
|
24
|
+
end
|
21
25
|
|
22
|
-
def
|
23
|
-
|
24
|
-
private name
|
26
|
+
def object(name)
|
27
|
+
alias_method name, :object
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
28
31
|
module WithContext
|
29
32
|
extend ActiveSupport::Concern
|
33
|
+
include Railjet::Presenter
|
30
34
|
|
31
35
|
included do
|
32
36
|
attr_reader :context
|
@@ -40,7 +44,15 @@ module Railjet
|
|
40
44
|
|
41
45
|
module ClassMethods
|
42
46
|
def present_collection(context, objects)
|
43
|
-
objects.map { |o|
|
47
|
+
objects.map { |o| present(context, o) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def present(context, object)
|
51
|
+
new(context, object)
|
52
|
+
end
|
53
|
+
|
54
|
+
def context(*context_members)
|
55
|
+
delegate *context_members, to: :context
|
44
56
|
end
|
45
57
|
end
|
46
58
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Railjet
|
2
|
+
class PresenterContext < SimpleDelegator
|
3
|
+
attr_reader :view
|
4
|
+
|
5
|
+
def initialize(context, view_context)
|
6
|
+
super(context)
|
7
|
+
@view = view_context
|
8
|
+
end
|
9
|
+
|
10
|
+
def repository
|
11
|
+
raise NoMethodError, "Acessing Repository from Presenter is a no-no 🙅♂️"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
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:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Zalewski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -161,7 +161,6 @@ files:
|
|
161
161
|
- ".rspec"
|
162
162
|
- ".ruby-gemset"
|
163
163
|
- ".ruby-version"
|
164
|
-
- ".travis.yml"
|
165
164
|
- Gemfile
|
166
165
|
- Gemfile.lock
|
167
166
|
- LICENSE.txt
|
@@ -186,6 +185,7 @@ files:
|
|
186
185
|
- lib/railjet/form.rb
|
187
186
|
- lib/railjet/policy.rb
|
188
187
|
- lib/railjet/presenter.rb
|
188
|
+
- lib/railjet/presenter_context.rb
|
189
189
|
- lib/railjet/repository.rb
|
190
190
|
- lib/railjet/repository/active_record.rb
|
191
191
|
- lib/railjet/repository/generic.rb
|
data/.travis.yml
DELETED