Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue: fix dry-configurable warnings #153

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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