rails-patterns 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +31 -21
- data/README.md +8 -0
- data/VERSION +1 -1
- data/lib/patterns/calculation.rb +5 -5
- data/rails-patterns.gemspec +22 -14
- data/spec/patterns/calculation_spec.rb +12 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f61449cb2feed58c4d3636c7e8cb06b9d6f93f7192861eb5c4567e114054610f
|
4
|
+
data.tar.gz: '08e88e618593983f3fd0b82af0f18b42792e4413a40c2711befffcf06be29106'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aac7fae367e8d81c4340f36680671f5ed4f292f72c956f8d1f3b28e9af87cb2c5d3257996be507af299dc0f27e45e07a848d7d3492b9c3f3c8a0a1a8278a1be
|
7
|
+
data.tar.gz: 2279865d364019b49ed9621eb325459f70c7a5f63d873e147ec16700d81248fcc6dbc5108e27cf919e554d4a5fc23a7c710fece598b5255223ce3fe838843c82
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -42,14 +42,17 @@ GEM
|
|
42
42
|
diff-lcs (1.3)
|
43
43
|
equalizer (0.0.11)
|
44
44
|
erubi (1.9.0)
|
45
|
-
faraday (
|
45
|
+
faraday (1.3.0)
|
46
|
+
faraday-net_http (~> 1.0)
|
46
47
|
multipart-post (>= 1.2, < 3)
|
47
|
-
|
48
|
+
ruby2_keywords
|
49
|
+
faraday-net_http (1.0.1)
|
50
|
+
git (1.8.1)
|
48
51
|
rchardet (~> 1.8)
|
49
|
-
github_api (0.
|
52
|
+
github_api (0.19.0)
|
50
53
|
addressable (~> 2.4)
|
51
54
|
descendants_tracker (~> 0.0.4)
|
52
|
-
faraday (
|
55
|
+
faraday (>= 0.8, < 2)
|
53
56
|
hashie (~> 3.5, >= 3.5.2)
|
54
57
|
oauth2 (~> 1.0)
|
55
58
|
hashie (3.6.0)
|
@@ -57,29 +60,34 @@ GEM
|
|
57
60
|
i18n (1.8.3)
|
58
61
|
concurrent-ruby (~> 1.0)
|
59
62
|
ice_nine (0.11.2)
|
60
|
-
juwelier (2.
|
63
|
+
juwelier (2.4.9)
|
61
64
|
builder
|
62
|
-
bundler
|
63
|
-
git
|
65
|
+
bundler
|
66
|
+
git
|
64
67
|
github_api
|
65
|
-
highline
|
66
|
-
|
68
|
+
highline
|
69
|
+
kamelcase (~> 0)
|
70
|
+
nokogiri
|
71
|
+
psych
|
67
72
|
rake
|
68
73
|
rdoc
|
69
|
-
|
70
|
-
jwt (2.2.
|
74
|
+
semver2
|
75
|
+
jwt (2.2.3)
|
76
|
+
kamelcase (0.0.2)
|
77
|
+
semver2 (~> 3)
|
71
78
|
loofah (2.6.0)
|
72
79
|
crass (~> 1.0.2)
|
73
80
|
nokogiri (>= 1.5.9)
|
74
81
|
method_source (0.9.0)
|
75
|
-
mini_portile2 (2.
|
82
|
+
mini_portile2 (2.5.3)
|
76
83
|
minitest (5.14.1)
|
77
|
-
multi_json (1.
|
84
|
+
multi_json (1.15.0)
|
78
85
|
multi_xml (0.6.0)
|
79
86
|
multipart-post (2.1.1)
|
80
|
-
nokogiri (1.
|
81
|
-
mini_portile2 (~> 2.
|
82
|
-
|
87
|
+
nokogiri (1.11.7)
|
88
|
+
mini_portile2 (~> 2.5.0)
|
89
|
+
racc (~> 1.4)
|
90
|
+
oauth2 (1.4.7)
|
83
91
|
faraday (>= 0.8, < 2.0)
|
84
92
|
jwt (>= 1.0, < 3.0)
|
85
93
|
multi_json (~> 1.3)
|
@@ -90,7 +98,9 @@ GEM
|
|
90
98
|
method_source (~> 0.9.0)
|
91
99
|
pry-rails (0.3.6)
|
92
100
|
pry (>= 0.10.4)
|
93
|
-
|
101
|
+
psych (4.0.1)
|
102
|
+
public_suffix (4.0.6)
|
103
|
+
racc (1.5.2)
|
94
104
|
rack (2.2.3)
|
95
105
|
rack-test (1.1.0)
|
96
106
|
rack (>= 1.0, < 3)
|
@@ -99,9 +109,9 @@ GEM
|
|
99
109
|
nokogiri (>= 1.6)
|
100
110
|
rails-html-sanitizer (1.3.0)
|
101
111
|
loofah (~> 2.3)
|
102
|
-
rake (13.0.
|
112
|
+
rake (13.0.3)
|
103
113
|
rchardet (1.8.0)
|
104
|
-
rdoc (6.
|
114
|
+
rdoc (6.3.1)
|
105
115
|
redis (4.1.4)
|
106
116
|
rspec (3.7.0)
|
107
117
|
rspec-core (~> 3.7.0)
|
@@ -119,7 +129,7 @@ GEM
|
|
119
129
|
rspec_junit_formatter (0.3.0)
|
120
130
|
rspec-core (>= 2, < 4, != 2.12.0)
|
121
131
|
ruby2_keywords (0.0.2)
|
122
|
-
|
132
|
+
semver2 (3.4.2)
|
123
133
|
thread_safe (0.3.6)
|
124
134
|
tzinfo (1.2.7)
|
125
135
|
thread_safe (~> 0.1)
|
@@ -137,7 +147,7 @@ DEPENDENCIES
|
|
137
147
|
actionpack (>= 4.2.6)
|
138
148
|
activerecord (>= 4.2.6)
|
139
149
|
bundler (~> 2.0)
|
140
|
-
juwelier
|
150
|
+
juwelier
|
141
151
|
pry-rails
|
142
152
|
redis
|
143
153
|
rspec
|
data/README.md
CHANGED
@@ -430,3 +430,11 @@ ResendOrderNotification.call(order) if OrderCompletedNotificationRuleset.new(ord
|
|
430
430
|
## Further reading
|
431
431
|
|
432
432
|
* [7 ways to decompose fat active record models](http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/)
|
433
|
+
|
434
|
+
## About Selleo
|
435
|
+
|
436
|
+
![selleo](https://raw.githubusercontent.com/Selleo/selleo-resources/master/public/github_footer.png)
|
437
|
+
|
438
|
+
Software development teams with an entrepreneurial sense of ownership at their core delivering great digital products and building culture people want to belong to. We are a community of engaged co-workers passionate about crafting impactful web solutions which transform the way our clients do business.
|
439
|
+
|
440
|
+
All names and logos for [Selleo](https://selleo.com/about) are trademark of Selleo sp. z o. o. sp. k.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/lib/patterns/calculation.rb
CHANGED
@@ -9,8 +9,8 @@ module Patterns
|
|
9
9
|
@subject = args.first
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.result(*args)
|
13
|
-
new(*args).cached_result
|
12
|
+
def self.result(*args, &block)
|
13
|
+
new(*args).cached_result(&block)
|
14
14
|
end
|
15
15
|
|
16
16
|
class << self
|
@@ -22,12 +22,12 @@ module Patterns
|
|
22
22
|
self.cache_expiry_every = period
|
23
23
|
end
|
24
24
|
|
25
|
-
def cached_result
|
25
|
+
def cached_result(&block)
|
26
26
|
if cache_expiry_period.blank?
|
27
|
-
result
|
27
|
+
result(&block)
|
28
28
|
else
|
29
29
|
Rails.cache.fetch(cache_key, expires_in: cache_expiry_period) do
|
30
|
-
result
|
30
|
+
result(&block)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/rails-patterns.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: rails-patterns 0.
|
5
|
+
# stub: rails-patterns 0.9.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "rails-patterns".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.9.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Stevo".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2021-06-25"
|
15
15
|
s.description = "A collection of lightweight, standardized, rails-oriented patterns.".freeze
|
16
16
|
s.email = "b.kosmowski@selleo.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -55,21 +55,29 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.homepage = "http://github.com/selleo/pattern".freeze
|
56
56
|
s.licenses = ["MIT".freeze]
|
57
57
|
s.required_ruby_version = Gem::Requirement.new(">= 2.5.0".freeze)
|
58
|
-
s.rubygems_version = "3.
|
58
|
+
s.rubygems_version = "3.0.8".freeze
|
59
59
|
s.summary = "A collection of lightweight, standardized, rails-oriented patterns.".freeze
|
60
60
|
|
61
61
|
if s.respond_to? :specification_version then
|
62
62
|
s.specification_version = 4
|
63
|
-
end
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
64
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
|
+
s.add_runtime_dependency(%q<activerecord>.freeze, [">= 4.2.6"])
|
66
|
+
s.add_runtime_dependency(%q<actionpack>.freeze, [">= 4.2.6"])
|
67
|
+
s.add_runtime_dependency(%q<virtus>.freeze, [">= 0"])
|
68
|
+
s.add_runtime_dependency(%q<ruby2_keywords>.freeze, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
70
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 2.0"])
|
71
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<activerecord>.freeze, [">= 4.2.6"])
|
74
|
+
s.add_dependency(%q<actionpack>.freeze, [">= 4.2.6"])
|
75
|
+
s.add_dependency(%q<virtus>.freeze, [">= 0"])
|
76
|
+
s.add_dependency(%q<ruby2_keywords>.freeze, [">= 0"])
|
77
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>.freeze, ["~> 2.0"])
|
79
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
80
|
+
end
|
73
81
|
else
|
74
82
|
s.add_dependency(%q<activerecord>.freeze, [">= 4.2.6"])
|
75
83
|
s.add_dependency(%q<actionpack>.freeze, [">= 4.2.6"])
|
@@ -77,7 +85,7 @@ Gem::Specification.new do |s|
|
|
77
85
|
s.add_dependency(%q<ruby2_keywords>.freeze, [">= 0"])
|
78
86
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
79
87
|
s.add_dependency(%q<bundler>.freeze, ["~> 2.0"])
|
80
|
-
s.add_dependency(%q<juwelier>.freeze, ["
|
88
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
@@ -60,6 +60,18 @@ RSpec.describe Patterns::Calculation do
|
|
60
60
|
|
61
61
|
expect(CustomCalculation.result(nil, arg_1: 20, arg_2: 30)).to eq([20, 30])
|
62
62
|
end
|
63
|
+
|
64
|
+
it 'executes calculation with given block' do
|
65
|
+
CustomCalculation = Class.new(Patterns::Calculation) do
|
66
|
+
private
|
67
|
+
|
68
|
+
def result
|
69
|
+
yield(subject)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
expect(CustomCalculation.result(5) { |a| a * 3 }).to eq(15)
|
74
|
+
end
|
63
75
|
end
|
64
76
|
|
65
77
|
describe "caching" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-patterns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stevo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: juwelier
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
description: A collection of lightweight, standardized, rails-oriented patterns.
|
112
112
|
email: b.kosmowski@selleo.com
|
113
113
|
executables: []
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
170
|
+
rubygems_version: 3.0.8
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: A collection of lightweight, standardized, rails-oriented patterns.
|