portrayal 0.1.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +24 -0
- data/CHANGELOG.md +35 -0
- data/Gemfile.lock +22 -22
- data/README.md +116 -11
- data/lib/portrayal.rb +17 -11
- data/lib/portrayal/schema.rb +56 -58
- data/lib/portrayal/version.rb +1 -1
- data/portrayal.gemspec +5 -5
- metadata +19 -19
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a6532caf62048d8a54a3dccfca29166c8277b47c19765d9ce8ee02b97ee709c
|
4
|
+
data.tar.gz: d58115282488d0c4dc22bacf65e8ea83e98986653b29798d6cade1d705e04fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c177e83e03d1d80e6bcfa1970c3786a9e496f5d1e09df05d7758772be244d1c056c28971c4c4b1de6c040c8ea839b34c4e69b2cdf38bdc2bd1269133640bad1b
|
7
|
+
data.tar.gz: d664544c2fa4b822c8d677efe546ae13521daed0e700fd20ec72255a13595014213934154abe5ef70f7a94dce8ef5a886493c430ba41791b1a9c38b57bdae2f4
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: RSpec
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby: [ '2.4', '2.5', '2.6', '2.7' ]
|
15
|
+
|
16
|
+
name: Ruby ${{ matrix.ruby }}
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: actions/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- run: gem install bundler
|
23
|
+
- run: bundle install
|
24
|
+
- run: bundle exec rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
2
|
+
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 0.6.0 - 2020-08-10
|
6
|
+
|
7
|
+
* Return keyword name from `keyword`, allowing usage such as `private keyword :foo`. [[commit]](https://github.com/scottscheapflights/portrayal/commit/9e9db2cafc7eae14789c5b84f70efd18898ace76)
|
8
|
+
|
9
|
+
## 0.5.0 - 2020-05-28
|
10
|
+
|
11
|
+
* Add option `define` for overriding nested class name. [[commit]](https://github.com/scottscheapflights/portrayal/commit/665ad297fb71fcdf5f641c672a457ccbe29e4a49)
|
12
|
+
|
13
|
+
## 0.4.0 - 2020-05-16
|
14
|
+
|
15
|
+
* Portrayal schema is deep-duped to subclasses. [[commit]](https://github.com/scottscheapflights/portrayal/commit/f346483a379ce9fbdece72cde8b0844f2d22b1cd)
|
16
|
+
|
17
|
+
## 0.3.1 - 2020-05-11
|
18
|
+
|
19
|
+
* Fix the issue introduced in 0.3.0 where `==` and `eql?` were always treating rhs as another portrayal class. [[commit]](https://github.com/scottscheapflights/portrayal/commit/f6ec8f373c6582f7e8d8f872d289222e4a58f8f6)
|
20
|
+
|
21
|
+
## 0.3.0 - 2020-05-09 (yanked)
|
22
|
+
|
23
|
+
* No longer compare classes in `==`, use `eql?` for that. [[commit]](https://github.com/scottscheapflights/portrayal/commit/9c5a37e4fb91e35d23b22e208344452930452af7)
|
24
|
+
* Define a protected writer for every keyword - useful when applying changes after `dup`/`clone`. [[commit]](https://github.com/scottscheapflights/portrayal/commit/1c0fa6c6357a09760dae39165e864238d231a08e)
|
25
|
+
* Add definition of `#hash` to fix hash equality. Now `hash[object]` will match if `object` is of the same class with the same keywords and values. [[commit]](https://github.com/scottscheapflights/portrayal/commit/ba9e390ab4aea4733ba084ac273da448e313ea53)
|
26
|
+
* Make `#freeze` propagate to all keyword values. [[commit]](https://github.com/scottscheapflights/portrayal/commit/0a734411a6eac08e2355c4277e09a2a70800d032)
|
27
|
+
* Make `#dup` and `#clone` propagate to all keyword values. [[commit]](https://github.com/scottscheapflights/portrayal/commit/010632d87d81a8d5b5ea5ff27d3d209cc667b0a5)
|
28
|
+
|
29
|
+
## 0.2.0 - 2019-07-03
|
30
|
+
|
31
|
+
* It's now possible to specify non-lambda default values, like `default: "foo"`. There is now also a distinction between a proc and a lambda default. Procs are `call`-ed, while lambdas or any other types are returned as-is. In the majority of cases defaults are static values, and there is no need for the performance overhead of making all defaults into anonymous functions. [[commit]](https://github.com/scottscheapflights/portrayal/commit/a1cc9d0fd40e413210f61b945d37b81c87280fee)
|
32
|
+
|
33
|
+
## 0.1.0
|
34
|
+
|
35
|
+
First version.
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
portrayal (0.
|
4
|
+
portrayal (0.6.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
coderay (1.1.2)
|
10
10
|
diff-lcs (1.3)
|
11
|
-
method_source (0.
|
12
|
-
pry (0.
|
13
|
-
coderay (~> 1.1
|
14
|
-
method_source (~>
|
15
|
-
rake (
|
16
|
-
rspec (3.
|
17
|
-
rspec-core (~> 3.
|
18
|
-
rspec-expectations (~> 3.
|
19
|
-
rspec-mocks (~> 3.
|
20
|
-
rspec-core (3.
|
21
|
-
rspec-support (~> 3.
|
22
|
-
rspec-expectations (3.
|
11
|
+
method_source (1.0.0)
|
12
|
+
pry (0.13.1)
|
13
|
+
coderay (~> 1.1)
|
14
|
+
method_source (~> 1.0)
|
15
|
+
rake (13.0.1)
|
16
|
+
rspec (3.9.0)
|
17
|
+
rspec-core (~> 3.9.0)
|
18
|
+
rspec-expectations (~> 3.9.0)
|
19
|
+
rspec-mocks (~> 3.9.0)
|
20
|
+
rspec-core (3.9.2)
|
21
|
+
rspec-support (~> 3.9.3)
|
22
|
+
rspec-expectations (3.9.2)
|
23
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-mocks (3.
|
24
|
+
rspec-support (~> 3.9.0)
|
25
|
+
rspec-mocks (3.9.1)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-support (3.
|
27
|
+
rspec-support (~> 3.9.0)
|
28
|
+
rspec-support (3.9.3)
|
29
29
|
|
30
30
|
PLATFORMS
|
31
31
|
ruby
|
32
32
|
|
33
33
|
DEPENDENCIES
|
34
|
-
bundler (~> 2.
|
34
|
+
bundler (~> 2.1)
|
35
35
|
portrayal!
|
36
|
-
pry (~> 0.
|
37
|
-
rake (~>
|
38
|
-
rspec (~> 3.
|
36
|
+
pry (~> 0.13)
|
37
|
+
rake (~> 13.0)
|
38
|
+
rspec (~> 3.9)
|
39
39
|
|
40
40
|
BUNDLED WITH
|
41
|
-
2.
|
41
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
![RSpec](https://github.com/scottscheapflights/portrayal/workflows/RSpec/badge.svg?branch=master)
|
2
|
+
|
1
3
|
# Portrayal
|
2
4
|
|
3
5
|
Inspired by:
|
@@ -14,7 +16,7 @@ class Person < MySuperClass
|
|
14
16
|
|
15
17
|
keyword :name
|
16
18
|
keyword :age, optional: true
|
17
|
-
keyword :favorite_fruit, default:
|
19
|
+
keyword :favorite_fruit, default: 'feijoa'
|
18
20
|
|
19
21
|
keyword :address do
|
20
22
|
keyword :street
|
@@ -30,8 +32,12 @@ end
|
|
30
32
|
When you call `keyword`:
|
31
33
|
|
32
34
|
* It defines an `attr_reader`
|
35
|
+
* It defines a protected `attr_writer`
|
33
36
|
* It defines `initialize`
|
34
37
|
* It defines `==` and `eql?`
|
38
|
+
* It defines `#hash` for hash equality
|
39
|
+
* It defines `#dup` and `#clone` that propagate to all keyword values
|
40
|
+
* It defines `#freeze` that propagates to all keyword values
|
35
41
|
* It creates a nested class when you supply a block
|
36
42
|
* It inherits parent's superclass when creating a nested class
|
37
43
|
|
@@ -39,25 +45,56 @@ The code above produces almost exactly the following ruby. There's a lot of boil
|
|
39
45
|
|
40
46
|
```ruby
|
41
47
|
class Person < MySuperClass
|
42
|
-
|
48
|
+
attr_accessor :name, :age, :favorite_fruit, :address
|
49
|
+
protected :name=, :age=, :favorite_fruit=, :address=
|
43
50
|
|
44
|
-
def initialize(name:, age: nil, favorite_fruit:
|
51
|
+
def initialize(name:, age: nil, favorite_fruit: 'feijoa', address:)
|
45
52
|
@name = name
|
46
53
|
@age = age
|
47
54
|
@favorite_fruit = favorite_fruit
|
48
55
|
@address = address
|
49
56
|
end
|
50
57
|
|
58
|
+
def eql?(other)
|
59
|
+
self.class == other.class && self == other
|
60
|
+
end
|
61
|
+
|
51
62
|
def ==(other)
|
52
|
-
|
53
|
-
{ name: name, age: age, favorite_fruit: favorite_fruit, address: address } ==
|
63
|
+
{ name: name, age: age, favorite_fruit: favorite_fruit, address: address } ==
|
54
64
|
{ name: other.name, age: other.age, favorite_fruit: other.favorite_fruit, address: other.address }
|
55
65
|
end
|
56
66
|
|
57
|
-
|
67
|
+
def hash
|
68
|
+
[ self.class, { name: name, age: age, favorite_fruit: favorite_fruit, address: address } ].hash
|
69
|
+
end
|
70
|
+
|
71
|
+
def freeze
|
72
|
+
name.freeze
|
73
|
+
age.freeze
|
74
|
+
favorite_fruit.freeze
|
75
|
+
address.freeze
|
76
|
+
super
|
77
|
+
end
|
78
|
+
|
79
|
+
def initialize_dup(source)
|
80
|
+
@name = source.name.dup
|
81
|
+
@age = source.age.dup
|
82
|
+
@favorite_fruit = source.favorite_fruit.dup
|
83
|
+
@address = source.address.dup
|
84
|
+
super
|
85
|
+
end
|
86
|
+
|
87
|
+
def initialize_clone(source)
|
88
|
+
@name = source.name.clone
|
89
|
+
@age = source.age.clone
|
90
|
+
@favorite_fruit = source.favorite_fruit.clone
|
91
|
+
@address = source.address.clone
|
92
|
+
super
|
93
|
+
end
|
58
94
|
|
59
95
|
class Address < MySuperClass
|
60
|
-
|
96
|
+
attr_accessor :street, :city
|
97
|
+
protected :street=, :city=
|
61
98
|
|
62
99
|
def initialize(street:, city:)
|
63
100
|
@street = street
|
@@ -68,12 +105,35 @@ class Person < MySuperClass
|
|
68
105
|
"#{street}, #{city}"
|
69
106
|
end
|
70
107
|
|
108
|
+
def eql?(other)
|
109
|
+
self.class == other.class && self == other
|
110
|
+
end
|
111
|
+
|
71
112
|
def ==(other)
|
72
|
-
|
73
|
-
{ street: street, city: city } == { street: other.street, city: other.city }
|
113
|
+
{ street: street, city: city } == { street: other.street, city: other.city }
|
74
114
|
end
|
75
115
|
|
76
|
-
|
116
|
+
def hash
|
117
|
+
[ self.class, { street: street, city: city } ].hash
|
118
|
+
end
|
119
|
+
|
120
|
+
def freeze
|
121
|
+
street.freeze
|
122
|
+
city.freeze
|
123
|
+
super
|
124
|
+
end
|
125
|
+
|
126
|
+
def initialize_dup(source)
|
127
|
+
@street = source.street.dup
|
128
|
+
@city = source.city.dup
|
129
|
+
super
|
130
|
+
end
|
131
|
+
|
132
|
+
def initialize_clone(source)
|
133
|
+
@street = source.street.clone
|
134
|
+
@city = source.city.clone
|
135
|
+
super
|
136
|
+
end
|
77
137
|
end
|
78
138
|
end
|
79
139
|
```
|
@@ -123,6 +183,51 @@ Possible use cases for these objects include, but are not limited to:
|
|
123
183
|
- Objects serializable for 3rd party APIs
|
124
184
|
- Objects serializable for React components
|
125
185
|
|
186
|
+
### Defaults
|
187
|
+
|
188
|
+
When specifying default, there's a difference between procs and lambda.
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
keyword :foo, default: proc { 2 + 2 } # => Will call this proc and return 4
|
192
|
+
keyword :foo, default: -> { 2 + 2 } # => Will return this lambda itself
|
193
|
+
```
|
194
|
+
|
195
|
+
Any other value works as normal.
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
keyword :foo, default: 4
|
199
|
+
```
|
200
|
+
|
201
|
+
### Nested Classes
|
202
|
+
|
203
|
+
When you pass a block to a keyword, it creates a nested class named after camelized keyword name.
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
class Person
|
207
|
+
extend Portrayal
|
208
|
+
|
209
|
+
keyword :address do
|
210
|
+
keyword :street
|
211
|
+
end
|
212
|
+
end
|
213
|
+
```
|
214
|
+
|
215
|
+
The above block created class `Person::Address`.
|
216
|
+
|
217
|
+
If you want to change the name of the created class, use the option `define`.
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
class Person
|
221
|
+
extend Portrayal
|
222
|
+
|
223
|
+
keyword :visited_countries, define: 'Country' do
|
224
|
+
keyword :name
|
225
|
+
end
|
226
|
+
end
|
227
|
+
```
|
228
|
+
|
229
|
+
This defines `Person::Country`, while the accessor remains `visited_countries`.
|
230
|
+
|
126
231
|
### Schema
|
127
232
|
|
128
233
|
Every class that has at least one keyword defined in it automatically receives a class method called `portrayal`. This method is a schema of your object with some additional helpers.
|
@@ -149,7 +254,7 @@ Address.portrayal.attributes(address) # => {street: '34th st', city: 'NYC', post
|
|
149
254
|
Get everything portrayal knows about your keywords in one hash.
|
150
255
|
|
151
256
|
```ruby
|
152
|
-
Address.portrayal.schema # => {:street=>{:optional=>false, :default=>nil}, :city=>{:optional=>false, :default=>nil}, :postcode=>{:optional=>false, :default=>nil}, :country=>{:optional=>true, :default
|
257
|
+
Address.portrayal.schema # => {:street=>{:optional=>false, :default=>nil}, :city=>{:optional=>false, :default=>nil}, :postcode=>{:optional=>false, :default=>nil}, :country=>{:optional=>true, :default=>[:return, nil]}}
|
153
258
|
```
|
154
259
|
|
155
260
|
## Philosophy
|
data/lib/portrayal.rb
CHANGED
@@ -2,26 +2,32 @@ require 'portrayal/version'
|
|
2
2
|
require 'portrayal/schema'
|
3
3
|
|
4
4
|
module Portrayal
|
5
|
-
|
5
|
+
NULL = :_portrayal_value_not_set
|
6
|
+
|
7
|
+
def keyword(name, optional: NULL, default: NULL, define: nil, &block)
|
6
8
|
unless respond_to?(:portrayal)
|
7
|
-
class << self
|
9
|
+
class << self
|
10
|
+
attr_reader :portrayal
|
11
|
+
def inherited(base)
|
12
|
+
base.instance_variable_set('@portrayal', portrayal.dup)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
@portrayal = Schema.new
|
17
|
+
class_eval(portrayal.definition_of_object_enhancements)
|
9
18
|
end
|
10
19
|
|
11
|
-
|
20
|
+
attr_accessor name
|
21
|
+
protected "#{name}="
|
12
22
|
|
13
23
|
portrayal.add_keyword(name, optional, default)
|
14
24
|
class_eval(portrayal.definition_of_initialize)
|
15
25
|
|
16
|
-
unless portrayal.equality_defined?
|
17
|
-
class_eval(portrayal.definition_of_equality)
|
18
|
-
portrayal.mark_equality_defined
|
19
|
-
end
|
20
|
-
|
21
26
|
if block_given?
|
22
|
-
|
23
|
-
|
24
|
-
const_set(portrayal.camelcase(name), keyword_class)
|
27
|
+
kw_class = Class.new(superclass) { extend Portrayal }
|
28
|
+
const_set(define || portrayal.camelize(name), kw_class).class_eval(&block)
|
25
29
|
end
|
30
|
+
|
31
|
+
name
|
26
32
|
end
|
27
33
|
end
|
data/lib/portrayal/schema.rb
CHANGED
@@ -1,90 +1,88 @@
|
|
1
1
|
module Portrayal
|
2
2
|
class Schema
|
3
|
-
NULL = :_portrayal_value_not_set
|
4
|
-
|
5
3
|
attr_reader :schema
|
6
4
|
|
7
|
-
def initialize
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def [](name)
|
13
|
-
@schema[name]
|
14
|
-
end
|
15
|
-
|
16
|
-
def keywords
|
17
|
-
@schema.keys
|
18
|
-
end
|
5
|
+
def initialize; @schema = {} end
|
6
|
+
def keywords; @schema.keys end
|
7
|
+
def [](name); @schema[name] end
|
19
8
|
|
20
9
|
def attributes(object)
|
21
|
-
Hash[
|
22
|
-
object.class.portrayal.keywords.map { |key| [key, object.send(key)] }
|
23
|
-
]
|
10
|
+
Hash[object.class.portrayal.keywords.map { |k| [k, object.send(k)] }]
|
24
11
|
end
|
25
12
|
|
13
|
+
def camelize(string); string.to_s.gsub(/(?:^|_+)([^_])/) { $1.upcase } end
|
14
|
+
|
26
15
|
def add_keyword(name, optional, default)
|
27
16
|
optional, default =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
[true, default]
|
34
|
-
else
|
35
|
-
[optional, optional ? default : nil]
|
17
|
+
case [optional == NULL, default == NULL]
|
18
|
+
when [true, true]; [false, nil]
|
19
|
+
when [false, true]; [optional, optional ? [:return, nil] : nil]
|
20
|
+
when [true, false]; [true, [default_strategy(default), default]]
|
21
|
+
else; [optional, optional ? [default_strategy(default), default] : nil]
|
36
22
|
end
|
37
23
|
|
38
24
|
@schema[name.to_sym] = { optional: optional, default: default }
|
39
25
|
end
|
40
26
|
|
41
|
-
def
|
42
|
-
|
27
|
+
def get_default(name)
|
28
|
+
action, value = @schema[name][:default]
|
29
|
+
action == :call ? value.call : value
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_strategy(value)
|
33
|
+
(value.is_a?(Proc) && !value.lambda?) ? :call : :return
|
43
34
|
end
|
44
35
|
|
45
|
-
def
|
46
|
-
|
36
|
+
def initialize_dup(other)
|
37
|
+
super
|
38
|
+
@schema =
|
39
|
+
other.schema.map { |k, v|
|
40
|
+
default = v[:default] ? v[:default].map(&:dup) : v[:default]
|
41
|
+
[k, { optional: v[:optional], default: default }]
|
42
|
+
}.to_h
|
47
43
|
end
|
48
44
|
|
49
45
|
def definition_of_initialize
|
50
|
-
init_args =
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
}
|
59
|
-
.join(',')
|
60
|
-
|
61
|
-
init_assignments =
|
62
|
-
@schema
|
63
|
-
.keys
|
64
|
-
.map { |name| "@#{name} = #{name}" }
|
65
|
-
.join('; ')
|
66
|
-
|
67
|
-
"def initialize(#{init_args}); #{init_assignments} end"
|
46
|
+
init_args = @schema.map { |name, config|
|
47
|
+
config[:optional] ?
|
48
|
+
"#{name}: self.class.portrayal.get_default(:#{name})" : "#{name}:"
|
49
|
+
}.join(',')
|
50
|
+
|
51
|
+
init_assigns = @schema.keys.map { |name| "@#{name} = #{name}" }.join('; ')
|
52
|
+
"def initialize(#{init_args}); #{init_assigns} end"
|
68
53
|
end
|
69
54
|
|
70
|
-
def
|
55
|
+
def definition_of_object_enhancements
|
71
56
|
<<-RUBY
|
57
|
+
def eql?(other); self.class == other.class && self == other end
|
58
|
+
def hash; [self.class, self.class.portrayal.attributes(self)].hash end
|
59
|
+
|
72
60
|
def ==(other)
|
73
|
-
|
74
|
-
|
61
|
+
return super unless other.class.is_a?(Portrayal)
|
62
|
+
|
63
|
+
self.class.portrayal.attributes(self) ==
|
75
64
|
self.class.portrayal.attributes(other)
|
76
65
|
end
|
77
66
|
|
78
|
-
|
79
|
-
|
80
|
-
|
67
|
+
def freeze
|
68
|
+
self.class.portrayal.attributes(self).values.each(&:freeze)
|
69
|
+
super
|
70
|
+
end
|
81
71
|
|
82
|
-
|
83
|
-
|
84
|
-
|
72
|
+
def initialize_dup(source)
|
73
|
+
self.class.portrayal.attributes(source).each do |key, value|
|
74
|
+
instance_variable_set('@' + key.to_s, value.dup)
|
75
|
+
end
|
76
|
+
super
|
77
|
+
end
|
85
78
|
|
86
|
-
|
87
|
-
|
79
|
+
def initialize_clone(source)
|
80
|
+
self.class.portrayal.attributes(source).each do |key, value|
|
81
|
+
instance_variable_set('@' + key.to_s, value.clone)
|
82
|
+
end
|
83
|
+
super
|
84
|
+
end
|
85
|
+
RUBY
|
88
86
|
end
|
89
87
|
end
|
90
88
|
end
|
data/lib/portrayal/version.rb
CHANGED
data/portrayal.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ['madfancier@gmail.com']
|
10
10
|
|
11
11
|
spec.summary = 'A minimal builder for struct-like classes'
|
12
|
-
spec.description = 'Inspired by dry-initializer and virtus, portrayal is a minimalist gem
|
12
|
+
spec.description = 'Inspired by dry-initializer and virtus, portrayal is a minimalist gem that takes a somewhat different approach to building struct-like classes. It steps away from types, coersion, and writer methods in favor of encouraging well-designed constructors. Read more in the Philosophy section of the README.'
|
13
13
|
spec.homepage = 'https://github.com/scottscheapflights/portrayal'
|
14
14
|
spec.license = 'Apache-2.0'
|
15
15
|
|
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
end
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
22
|
-
spec.add_development_dependency 'rake', '~>
|
23
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
24
|
-
spec.add_development_dependency 'pry', '~> 0.
|
21
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
22
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
24
|
+
spec.add_development_dependency 'pry', '~> 0.13'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: portrayal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Chernyak
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.9'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.13'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.13'
|
69
69
|
description: Inspired by dry-initializer and virtus, portrayal is a minimalist gem
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
the README.
|
70
|
+
that takes a somewhat different approach to building struct-like classes. It steps
|
71
|
+
away from types, coersion, and writer methods in favor of encouraging well-designed
|
72
|
+
constructors. Read more in the Philosophy section of the README.
|
74
73
|
email:
|
75
74
|
- madfancier@gmail.com
|
76
75
|
executables: []
|
77
76
|
extensions: []
|
78
77
|
extra_rdoc_files: []
|
79
78
|
files:
|
79
|
+
- ".github/workflows/rspec.yml"
|
80
80
|
- ".gitignore"
|
81
81
|
- ".rspec"
|
82
|
-
-
|
82
|
+
- CHANGELOG.md
|
83
83
|
- CODE_OF_CONDUCT.md
|
84
84
|
- Gemfile
|
85
85
|
- Gemfile.lock
|
@@ -96,7 +96,7 @@ homepage: https://github.com/scottscheapflights/portrayal
|
|
96
96
|
licenses:
|
97
97
|
- Apache-2.0
|
98
98
|
metadata: {}
|
99
|
-
post_install_message:
|
99
|
+
post_install_message:
|
100
100
|
rdoc_options: []
|
101
101
|
require_paths:
|
102
102
|
- lib
|
@@ -111,8 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
114
|
+
rubygems_version: 3.1.2
|
115
|
+
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: A minimal builder for struct-like classes
|
118
118
|
test_files: []
|