dry-view 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE +1 -1
- data/README.md +6 -13
- data/dry-view.gemspec +15 -14
- data/lib/dry/view/exposure.rb +6 -8
- data/lib/dry/view/exposures.rb +0 -1
- data/lib/dry/view/part.rb +2 -5
- data/lib/dry/view/part_builder.rb +1 -3
- data/lib/dry/view/scope_builder.rb +1 -1
- data/lib/dry/view/tilt/haml.rb +3 -3
- data/lib/dry/view/version.rb +1 -1
- data/lib/dry/view.rb +10 -10
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70b00212a774fa6075ff58086540e985cfeb251a1888faa349d219f27760c2eb
|
4
|
+
data.tar.gz: 29c6c92656d5ba45b0707404e87dfa7526ae61550cb8acf7b5a038ba2b071649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7e323b9a836df03ad6913341d2d59c69ce3f48c90fa232094e52fe70b3151e487a7607ffdac56d2a7e94e5ab5b6a72278e10670f226c7acbb0090e40887a416
|
7
|
+
data.tar.gz: b3a239a7d852536a3b5fb719b24f9c2cd867b5390232b975a7d497747cce1056ddb65ddedc47e91dc5a486c0833c03af1d9ffeac9271a68d7e4bfbef15c1adc2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 0.8.0 2024-11-20
|
4
|
+
|
5
|
+
|
6
|
+
### Fixed
|
7
|
+
|
8
|
+
- Fix dry-configurable warnings (@olegykz in #153)
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Require hamlit instead of hamlit/block (@olegykz in #155)
|
13
|
+
|
14
|
+
[Compare v0.7.1...v0.8.0](https://github.com/dry-rb/dry-view/compare/v0.7.1...v0.8.0)
|
15
|
+
|
3
16
|
## 0.7.1 2021-02-08
|
4
17
|
|
5
18
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,21 @@
|
|
1
|
+
<!--- this file is synced from dry-rb/template-gem project -->
|
1
2
|
[gem]: https://rubygems.org/gems/dry-view
|
2
3
|
[actions]: https://github.com/dry-rb/dry-view/actions
|
3
|
-
[codacy]: https://www.codacy.com/gh/dry-rb/dry-view
|
4
|
-
[chat]: https://dry-rb.zulipchat.com
|
5
|
-
[inchpages]: http://inch-ci.org/github/dry-rb/dry-view
|
6
4
|
|
7
|
-
# dry-view [![
|
8
|
-
|
9
|
-
[![Gem Version](https://badge.fury.io/rb/dry-view.svg)][gem]
|
10
|
-
[![CI Status](https://github.com/dry-rb/dry-view/workflows/ci/badge.svg)][actions]
|
11
|
-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fe8a45d76d8b45f6a680a29c48b43a99)][codacy]
|
12
|
-
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/fe8a45d76d8b45f6a680a29c48b43a99)][codacy]
|
13
|
-
[![Inline docs](http://inch-ci.org/github/dry-rb/dry-view.svg?branch=master)][inchpages]
|
5
|
+
# dry-view [![Gem Version](https://badge.fury.io/rb/dry-view.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-view/workflows/ci/badge.svg)][actions]
|
14
6
|
|
15
7
|
## Links
|
16
8
|
|
17
|
-
* [User documentation](
|
9
|
+
* [User documentation](https://dry-rb.org/gems/dry-view)
|
18
10
|
* [API documentation](http://rubydoc.info/gems/dry-view)
|
11
|
+
* [Forum](https://discourse.dry-rb.org)
|
19
12
|
|
20
13
|
## Supported Ruby versions
|
21
14
|
|
22
15
|
This library officially supports the following Ruby versions:
|
23
16
|
|
24
|
-
* MRI
|
25
|
-
* jruby
|
17
|
+
* MRI `>= 3.0.0`
|
18
|
+
* jruby `>= 9.4` (not tested on CI)
|
26
19
|
|
27
20
|
## License
|
28
21
|
|
data/dry-view.gemspec
CHANGED
@@ -1,36 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# this file is managed by dry-rb/devtools project
|
3
2
|
|
4
|
-
|
3
|
+
# this file is synced from dry-rb/template-gem project
|
4
|
+
|
5
|
+
lib = File.expand_path("lib", __dir__)
|
5
6
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
-
require
|
7
|
+
require "dry/view/version"
|
7
8
|
|
8
9
|
Gem::Specification.new do |spec|
|
9
|
-
spec.name =
|
10
|
+
spec.name = "dry-view"
|
10
11
|
spec.authors = ["Tim Riley", "Piotr Solnica"]
|
11
12
|
spec.email = ["tim@icelab.com.au", "piotr.solnica@gmail.com"]
|
12
|
-
spec.license =
|
13
|
+
spec.license = "MIT"
|
13
14
|
spec.version = Dry::View::VERSION.dup
|
14
15
|
|
15
16
|
spec.summary = "A complete, standalone view rendering system that gives you everything you need to write well-factored view code"
|
16
17
|
spec.description = spec.summary
|
17
|
-
spec.homepage =
|
18
|
+
spec.homepage = "https://dry-rb.org/gems/dry-view"
|
18
19
|
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-view.gemspec", "lib/**/*"]
|
19
|
-
spec.bindir =
|
20
|
+
spec.bindir = "bin"
|
20
21
|
spec.executables = []
|
21
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ["lib"]
|
22
23
|
|
23
|
-
spec.metadata[
|
24
|
-
spec.metadata[
|
25
|
-
spec.metadata[
|
26
|
-
spec.metadata[
|
24
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-view/blob/main/CHANGELOG.md"
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-view"
|
27
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-view/issues"
|
27
28
|
|
28
|
-
spec.required_ruby_version = ">=
|
29
|
+
spec.required_ruby_version = ">= 3.0.0"
|
29
30
|
|
30
31
|
# to update dependencies edit project.yml
|
31
32
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
32
33
|
spec.add_runtime_dependency "dry-configurable", "~> 0.1"
|
33
|
-
spec.add_runtime_dependency "dry-core", "~> 0.
|
34
|
+
spec.add_runtime_dependency "dry-core", "~> 0.9", ">= 0.9"
|
34
35
|
spec.add_runtime_dependency "dry-inflector", "~> 0.1"
|
35
36
|
spec.add_runtime_dependency "tilt", "~> 2.0", ">= 2.0.6"
|
36
37
|
|
data/lib/dry/view/exposure.rb
CHANGED
@@ -50,15 +50,15 @@ module Dry
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def for_layout?
|
53
|
-
options.fetch(:layout
|
53
|
+
options.fetch(:layout, false)
|
54
54
|
end
|
55
55
|
|
56
56
|
def decorate?
|
57
|
-
options.fetch(:decorate
|
57
|
+
options.fetch(:decorate, true)
|
58
58
|
end
|
59
59
|
|
60
60
|
def private?
|
61
|
-
options.fetch(:private
|
61
|
+
options.fetch(:private, false)
|
62
62
|
end
|
63
63
|
|
64
64
|
def default_value
|
@@ -84,12 +84,10 @@ module Dry
|
|
84
84
|
else
|
85
85
|
object.instance_exec(*args, &proc)
|
86
86
|
end
|
87
|
+
elsif proc.is_a?(Method)
|
88
|
+
proc.(*args, **keywords)
|
87
89
|
else
|
88
|
-
|
89
|
-
proc.(*args, **keywords)
|
90
|
-
else
|
91
|
-
object.instance_exec(*args, **keywords, &proc)
|
92
|
-
end
|
90
|
+
object.instance_exec(*args, **keywords, &proc)
|
93
91
|
end
|
94
92
|
end
|
95
93
|
|
data/lib/dry/view/exposures.rb
CHANGED
data/lib/dry/view/part.rb
CHANGED
@@ -71,9 +71,8 @@ module Dry
|
|
71
71
|
#
|
72
72
|
# @api public
|
73
73
|
def initialize(
|
74
|
-
render_env: RenderEnvironmentMissing.new,
|
75
|
-
name: self.class.part_name(render_env.inflector)
|
76
|
-
value:
|
74
|
+
value:, render_env: RenderEnvironmentMissing.new,
|
75
|
+
name: self.class.part_name(render_env.inflector)
|
77
76
|
)
|
78
77
|
@_name = name
|
79
78
|
@_value = value
|
@@ -126,11 +125,9 @@ module Dry
|
|
126
125
|
# @return [String] rendered partial
|
127
126
|
#
|
128
127
|
# @api public
|
129
|
-
# rubocop:disable Naming/UncommunicativeMethodParamName
|
130
128
|
def _render(partial_name, as: _name, **locals, &block)
|
131
129
|
_render_env.partial(partial_name, _render_env.scope({as => self}.merge(locals)), &block)
|
132
130
|
end
|
133
|
-
# rubocop:enable Naming/UncommunicativeMethodParamName
|
134
131
|
|
135
132
|
# Builds a new scope with the part included in its locals.
|
136
133
|
#
|
@@ -108,7 +108,6 @@ module Dry
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
112
111
|
def resolve_part_class(name:, fallback_class:)
|
113
112
|
return fallback_class unless namespace
|
114
113
|
|
@@ -117,7 +116,7 @@ module Dry
|
|
117
116
|
# Give autoloaders a chance to act
|
118
117
|
begin
|
119
118
|
klass = namespace.const_get(name)
|
120
|
-
rescue NameError # rubocop:disable Lint/
|
119
|
+
rescue NameError # rubocop:disable Lint/SuppressedException
|
121
120
|
end
|
122
121
|
|
123
122
|
if !klass && namespace.const_defined?(name, false)
|
@@ -130,7 +129,6 @@ module Dry
|
|
130
129
|
fallback_class
|
131
130
|
end
|
132
131
|
end
|
133
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
134
132
|
|
135
133
|
def inflector
|
136
134
|
render_env.inflector
|
@@ -76,7 +76,7 @@ module Dry
|
|
76
76
|
# Give autoloaders a chance to act
|
77
77
|
begin
|
78
78
|
klass = namespace.const_get(name)
|
79
|
-
rescue NameError # rubocop:disable Lint/
|
79
|
+
rescue NameError # rubocop:disable Lint/SuppressedException
|
80
80
|
end
|
81
81
|
|
82
82
|
if !klass && namespace.const_defined?(name, false)
|
data/lib/dry/view/tilt/haml.rb
CHANGED
@@ -5,8 +5,8 @@ module Dry
|
|
5
5
|
module Tilt
|
6
6
|
module Haml
|
7
7
|
def self.requirements
|
8
|
-
["hamlit
|
9
|
-
dry-view requires hamlit
|
8
|
+
["hamlit", <<~ERROR]
|
9
|
+
dry-view requires hamlit (3.0 or greater) for full compatibility when rendering .haml templates (e.g. implicitly capturing block content when yielding)
|
10
10
|
|
11
11
|
To ignore this and use another engine for .haml templates, dereigster this adapter before calling your views:
|
12
12
|
|
@@ -15,7 +15,7 @@ module Dry
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.activate
|
18
|
-
# Requiring hamlit
|
18
|
+
# Requiring hamlit will register the engine with Tilt
|
19
19
|
self
|
20
20
|
end
|
21
21
|
end
|
data/lib/dry/view/version.rb
CHANGED
data/lib/dry/view.rb
CHANGED
@@ -58,7 +58,7 @@ module Dry
|
|
58
58
|
#
|
59
59
|
# @api public
|
60
60
|
# @!scope class
|
61
|
-
setting :paths
|
61
|
+
setting :paths, constructor: -> paths do
|
62
62
|
Array(paths).map { |path| Path[path] }
|
63
63
|
end
|
64
64
|
|
@@ -83,7 +83,7 @@ module Dry
|
|
83
83
|
# @param name [String, FalseClass, nil] layout name, or false to indicate no layout
|
84
84
|
# @api public
|
85
85
|
# @!scope class
|
86
|
-
setting :layout, false
|
86
|
+
setting :layout, default: false
|
87
87
|
|
88
88
|
# @overload config.layouts_dir=(dir)
|
89
89
|
# Set the name of the directory (within the configured `paths`) holding
|
@@ -92,7 +92,7 @@ module Dry
|
|
92
92
|
# @param dir [String] directory name
|
93
93
|
# @api public
|
94
94
|
# @!scope class
|
95
|
-
setting :layouts_dir, "layouts"
|
95
|
+
setting :layouts_dir, default: "layouts"
|
96
96
|
|
97
97
|
# @overload config.scope=(scope_class)
|
98
98
|
# Set the scope class to use when rendering the view's template.
|
@@ -118,7 +118,7 @@ module Dry
|
|
118
118
|
# @param context [Dry::View::Context] context object
|
119
119
|
# @api public
|
120
120
|
# @!scope class
|
121
|
-
setting :default_context, Context.new.freeze
|
121
|
+
setting :default_context, default: Context.new.freeze
|
122
122
|
|
123
123
|
# @overload config.default_format=(format)
|
124
124
|
# Set the default format to use when rendering.
|
@@ -128,7 +128,7 @@ module Dry
|
|
128
128
|
# @param format [Symbol]
|
129
129
|
# @api public
|
130
130
|
# @!scope class
|
131
|
-
setting :default_format, :html
|
131
|
+
setting :default_format, default: :html
|
132
132
|
|
133
133
|
# @overload config.scope_namespace=(namespace)
|
134
134
|
# Set a namespace that will be searched when building scope classes.
|
@@ -149,7 +149,7 @@ module Dry
|
|
149
149
|
# @param part_builder [Class]
|
150
150
|
# @api public
|
151
151
|
# @!scope class
|
152
|
-
setting :part_builder, PartBuilder
|
152
|
+
setting :part_builder, default: PartBuilder
|
153
153
|
|
154
154
|
# @overload config.scope_namespace=(namespace)
|
155
155
|
# Set a namespace that will be searched when building scope classes.
|
@@ -170,7 +170,7 @@ module Dry
|
|
170
170
|
# @param scope_builder [Class]
|
171
171
|
# @api public
|
172
172
|
# @!scope class
|
173
|
-
setting :scope_builder, ScopeBuilder
|
173
|
+
setting :scope_builder, default: ScopeBuilder
|
174
174
|
|
175
175
|
# @overload config.inflector=(inflector)
|
176
176
|
# Set an inflector to provide to the part_builder and scope_builder.
|
@@ -180,7 +180,7 @@ module Dry
|
|
180
180
|
# @param inflector
|
181
181
|
# @api public
|
182
182
|
# @!scope class
|
183
|
-
setting :inflector, Dry::Inflector.new
|
183
|
+
setting :inflector, default: Dry::Inflector.new
|
184
184
|
|
185
185
|
# @overload config.renderer_options=(options)
|
186
186
|
# A hash of options to pass to the template engine. Template engines are
|
@@ -195,7 +195,7 @@ module Dry
|
|
195
195
|
# @param options [Hash] renderer options
|
196
196
|
# @api public
|
197
197
|
# @!scope class
|
198
|
-
setting :renderer_options, DEFAULT_RENDERER_OPTIONS
|
198
|
+
setting :renderer_options, default: DEFAULT_RENDERER_OPTIONS, constructor: -> options do
|
199
199
|
DEFAULT_RENDERER_OPTIONS.merge(options.to_h).freeze
|
200
200
|
end
|
201
201
|
|
@@ -508,7 +508,7 @@ module Dry
|
|
508
508
|
|
509
509
|
# @api private
|
510
510
|
def layout?
|
511
|
-
!!config.layout
|
511
|
+
!!config.layout
|
512
512
|
end
|
513
513
|
end
|
514
514
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Riley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -45,20 +45,20 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0.
|
48
|
+
version: '0.9'
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '0.
|
51
|
+
version: '0.9'
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - "~>"
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: '0.
|
58
|
+
version: '0.9'
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.9'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: dry-inflector
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,7 @@ licenses:
|
|
174
174
|
- MIT
|
175
175
|
metadata:
|
176
176
|
allowed_push_host: https://rubygems.org
|
177
|
-
changelog_uri: https://github.com/dry-rb/dry-view/blob/
|
177
|
+
changelog_uri: https://github.com/dry-rb/dry-view/blob/main/CHANGELOG.md
|
178
178
|
source_code_uri: https://github.com/dry-rb/dry-view
|
179
179
|
bug_tracker_uri: https://github.com/dry-rb/dry-view/issues
|
180
180
|
post_install_message:
|
@@ -185,14 +185,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: 3.0.0
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
191
|
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
195
|
+
rubygems_version: 3.3.27
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: A complete, standalone view rendering system that gives you everything you
|