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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e819c2e7fc0b6fe2aed059b2d63993b2e107e7d9b682652dc9a0dedefdf7458
4
- data.tar.gz: e45c5c695005d30eb755ccffd22efc5bbdf7c91b018f4c2fe859cb6b015f70bc
3
+ metadata.gz: 70b00212a774fa6075ff58086540e985cfeb251a1888faa349d219f27760c2eb
4
+ data.tar.gz: 29c6c92656d5ba45b0707404e87dfa7526ae61550cb8acf7b5a038ba2b071649
5
5
  SHA512:
6
- metadata.gz: a4797bca5d6dba8ba676794d9ff21c531c1ee303a0af87f924ee09e89c9faadc898f5b1dc9d24731c32e62d5b5c031efa4b6f8a7062ab30bd3f7ea4397eac7b2
7
- data.tar.gz: 60fe4d2131720fd19cebe465283f06f05abb0247b094fc946ff96ac9b0b77c5962561ee68da1dd067876ace1d5def0caccdf18e7598a25800cf199aad5f36772
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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2021 dry-rb team
3
+ Copyright (c) 2015-2023 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
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 [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
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](http://dry-rb.org/gems/dry-view)
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 >= `2.5`
25
- * jruby >= `9.2`
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
- lib = File.expand_path('lib', __dir__)
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 'dry/view/version'
7
+ require "dry/view/version"
7
8
 
8
9
  Gem::Specification.new do |spec|
9
- spec.name = 'dry-view'
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 = 'MIT'
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 = 'https://dry-rb.org/gems/dry-view'
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 = 'bin'
20
+ spec.bindir = "bin"
20
21
  spec.executables = []
21
- spec.require_paths = ['lib']
22
+ spec.require_paths = ["lib"]
22
23
 
23
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
- spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-view/blob/master/CHANGELOG.md'
25
- spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-view'
26
- spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-view/issues'
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 = ">= 2.5.0"
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.5", ">= 0.5"
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
 
@@ -50,15 +50,15 @@ module Dry
50
50
  end
51
51
 
52
52
  def for_layout?
53
- options.fetch(:layout) { false }
53
+ options.fetch(:layout, false)
54
54
  end
55
55
 
56
56
  def decorate?
57
- options.fetch(:decorate) { true }
57
+ options.fetch(:decorate, true)
58
58
  end
59
59
 
60
60
  def private?
61
- options.fetch(:private) { false }
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
- if proc.is_a?(Method)
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
 
@@ -46,7 +46,6 @@ module Dry
46
46
  end
47
47
 
48
48
  def call(input)
49
- # rubocop:disable Style/MultilineBlockChain
50
49
  tsort.each_with_object({}) { |name, memo|
51
50
  next unless (exposure = self[name])
52
51
 
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/HandleExceptions
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/HandleExceptions
79
+ rescue NameError # rubocop:disable Lint/SuppressedException
80
80
  end
81
81
 
82
82
  if !klass && namespace.const_defined?(name, false)
@@ -5,8 +5,8 @@ module Dry
5
5
  module Tilt
6
6
  module Haml
7
7
  def self.requirements
8
- ["hamlit/block", <<~ERROR]
9
- dry-view requires hamlit-block for full compatibility when rendering .haml templates (e.g. implicitly capturing block content when yielding)
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/block will register the engine with Tilt
18
+ # Requiring hamlit will register the engine with Tilt
19
19
  self
20
20
  end
21
21
  end
@@ -3,6 +3,6 @@
3
3
  module Dry
4
4
  class View
5
5
  # @api private
6
- VERSION = "0.7.1"
6
+ VERSION = "0.8.0"
7
7
  end
8
8
  end
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 do |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 do |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 # rubocop:disable Style/DoubleNegation
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.7.1
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: 2021-02-08 00:00:00.000000000 Z
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.5'
48
+ version: '0.9'
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: '0.5'
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.5'
58
+ version: '0.9'
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.5'
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/master/CHANGELOG.md
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: 2.5.0
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.1.4
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