Skip to content

Commit

Permalink
Merge pull request #153 from olegykz/issue/dry-configurable-warnings
Browse files Browse the repository at this point in the history
[changelog]

version: unreleased
fixed: "Fix dry-configurable warnings (via #153) (@olegykz)"
  • Loading branch information
solnic committed Sep 6, 2022
2 parents 2aaf928 + abaacb2 commit b62b593
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions lib/dry/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class View
#
# @api public
# @!scope class
setting :paths do |paths|
setting :paths, constructor: -> paths do
Array(paths).map { |path| Path[path] }
end

Expand All @@ -83,7 +83,7 @@ class View
# @param name [String, FalseClass, nil] layout name, or false to indicate no layout
# @api public
# @!scope class
setting :layout, false
setting :layout, default: false

# @overload config.layouts_dir=(dir)
# Set the name of the directory (within the configured `paths`) holding
Expand All @@ -92,7 +92,7 @@ class View
# @param dir [String] directory name
# @api public
# @!scope class
setting :layouts_dir, "layouts"
setting :layouts_dir, default: "layouts"

# @overload config.scope=(scope_class)
# Set the scope class to use when rendering the view's template.
Expand All @@ -118,7 +118,7 @@ class View
# @param context [Dry::View::Context] context object
# @api public
# @!scope class
setting :default_context, Context.new.freeze
setting :default_context, default: Context.new.freeze

# @overload config.default_format=(format)
# Set the default format to use when rendering.
Expand All @@ -128,7 +128,7 @@ class View
# @param format [Symbol]
# @api public
# @!scope class
setting :default_format, :html
setting :default_format, default: :html

# @overload config.scope_namespace=(namespace)
# Set a namespace that will be searched when building scope classes.
Expand All @@ -149,7 +149,7 @@ class View
# @param part_builder [Class]
# @api public
# @!scope class
setting :part_builder, PartBuilder
setting :part_builder, default: PartBuilder

# @overload config.scope_namespace=(namespace)
# Set a namespace that will be searched when building scope classes.
Expand All @@ -170,7 +170,7 @@ class View
# @param scope_builder [Class]
# @api public
# @!scope class
setting :scope_builder, ScopeBuilder
setting :scope_builder, default: ScopeBuilder

# @overload config.inflector=(inflector)
# Set an inflector to provide to the part_builder and scope_builder.
Expand All @@ -180,7 +180,7 @@ class View
# @param inflector
# @api public
# @!scope class
setting :inflector, Dry::Inflector.new
setting :inflector, default: Dry::Inflector.new

# @overload config.renderer_options=(options)
# A hash of options to pass to the template engine. Template engines are
Expand All @@ -195,7 +195,7 @@ class View
# @param options [Hash] renderer options
# @api public
# @!scope class
setting :renderer_options, DEFAULT_RENDERER_OPTIONS do |options|
setting :renderer_options, default: DEFAULT_RENDERER_OPTIONS, constructor: -> options do
DEFAULT_RENDERER_OPTIONS.merge(options.to_h).freeze
end

Expand Down
6 changes: 3 additions & 3 deletions spec/integration/view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def assets
let(:parent_view) do
klass = Class.new(Dry::View)

klass.setting :paths, SPEC_ROOT.join("fixtures/templates")
klass.setting :layout, "app"
klass.setting :formats, html: :slim
klass.setting :paths, default: SPEC_ROOT.join("fixtures/templates")
klass.setting :layout, default: "app"
klass.setting :formats, default: { html: :slim }

klass
end
Expand Down

0 comments on commit b62b593

Please sign in to comment.