praxis-blueprints 2.2 → 3.0
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/.travis.yml +1 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +1 -2
- data/lib/praxis-blueprints.rb +3 -0
- data/lib/praxis-blueprints/blueprint.rb +61 -55
- data/lib/praxis-blueprints/collection_view.rb +12 -15
- data/lib/praxis-blueprints/field_expander.rb +104 -0
- data/lib/praxis-blueprints/renderer.rb +71 -0
- data/lib/praxis-blueprints/version.rb +1 -1
- data/lib/praxis-blueprints/view.rb +44 -63
- data/praxis-blueprints.gemspec +2 -2
- data/spec/praxis-blueprints/blueprint_spec.rb +155 -205
- data/spec/praxis-blueprints/collection_view_spec.rb +38 -24
- data/spec/praxis-blueprints/field_expander_spec.rb +169 -0
- data/spec/praxis-blueprints/renderer_spec.rb +142 -0
- data/spec/praxis-blueprints/view_spec.rb +45 -315
- data/spec/support/spec_blueprints.rb +8 -8
- metadata +10 -4
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
class Person < Praxis::Blueprint
|
3
2
|
attributes do
|
4
3
|
attribute :name, String, example: /[:first_name:]/
|
@@ -10,14 +9,15 @@ class Person < Praxis::Blueprint
|
|
10
9
|
attribute :aliases, Attributor::Collection.of(FullName)
|
11
10
|
|
12
11
|
attribute :address, Address, example: proc { |person, context| Address.example(context, resident: person) }
|
12
|
+
attribute :work_address, Address
|
13
13
|
|
14
14
|
attribute :prior_addresses, Attributor::Collection.of(Address)
|
15
|
-
|
16
15
|
attribute :parents do
|
17
16
|
attribute :father, String
|
18
17
|
attribute :mother, String
|
19
18
|
end
|
20
19
|
|
20
|
+
attribute :tags, Attributor::Collection.of(String)
|
21
21
|
attribute :href, String
|
22
22
|
attribute :alive, Attributor::Boolean, default: true
|
23
23
|
end
|
@@ -26,6 +26,7 @@ class Person < Praxis::Blueprint
|
|
26
26
|
attribute :name
|
27
27
|
attribute :full_name
|
28
28
|
attribute :address
|
29
|
+
attribute :prior_addresses
|
29
30
|
end
|
30
31
|
|
31
32
|
view :current do
|
@@ -46,12 +47,6 @@ class Person < Praxis::Blueprint
|
|
46
47
|
attribute :alive
|
47
48
|
end
|
48
49
|
|
49
|
-
view :with_unset, include_unset: true do
|
50
|
-
attribute :name
|
51
|
-
attribute :email
|
52
|
-
attribute :age
|
53
|
-
end
|
54
|
-
|
55
50
|
end
|
56
51
|
|
57
52
|
|
@@ -74,6 +69,11 @@ class Address < Praxis::Blueprint
|
|
74
69
|
attribute :state
|
75
70
|
end
|
76
71
|
|
72
|
+
view :extended do
|
73
|
+
attribute :state
|
74
|
+
attribute :street
|
75
|
+
attribute :resident
|
76
|
+
end
|
77
77
|
|
78
78
|
end
|
79
79
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: praxis-blueprints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '3.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep M. Blanquer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: randexp
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 4.
|
34
|
+
version: '4.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 4.
|
41
|
+
version: '4.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: activesupport
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,12 +230,16 @@ files:
|
|
230
230
|
- lib/praxis-blueprints/blueprint.rb
|
231
231
|
- lib/praxis-blueprints/collection_view.rb
|
232
232
|
- lib/praxis-blueprints/config_hash.rb
|
233
|
+
- lib/praxis-blueprints/field_expander.rb
|
233
234
|
- lib/praxis-blueprints/finalizable.rb
|
235
|
+
- lib/praxis-blueprints/renderer.rb
|
234
236
|
- lib/praxis-blueprints/version.rb
|
235
237
|
- lib/praxis-blueprints/view.rb
|
236
238
|
- praxis-blueprints.gemspec
|
237
239
|
- spec/praxis-blueprints/blueprint_spec.rb
|
238
240
|
- spec/praxis-blueprints/collection_view_spec.rb
|
241
|
+
- spec/praxis-blueprints/field_expander_spec.rb
|
242
|
+
- spec/praxis-blueprints/renderer_spec.rb
|
239
243
|
- spec/praxis-blueprints/view_spec.rb
|
240
244
|
- spec/spec_helper.rb
|
241
245
|
- spec/support/spec_blueprints.rb
|
@@ -267,6 +271,8 @@ summary: Attributes, views, rendering and example generation for common Blueprin
|
|
267
271
|
test_files:
|
268
272
|
- spec/praxis-blueprints/blueprint_spec.rb
|
269
273
|
- spec/praxis-blueprints/collection_view_spec.rb
|
274
|
+
- spec/praxis-blueprints/field_expander_spec.rb
|
275
|
+
- spec/praxis-blueprints/renderer_spec.rb
|
270
276
|
- spec/praxis-blueprints/view_spec.rb
|
271
277
|
- spec/spec_helper.rb
|
272
278
|
- spec/support/spec_blueprints.rb
|