File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ nav_order: 6
1010
1111## main
1212
13+ * Resolve deprecation warning for ` ActiveSupport::Configurable ` .
14+
15+ * Simon Fish*
16+
1317* Make ` ViewComponent::VERSION ` accessible to other gems by default.
1418
1519 * Hans Lemuet*
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33require "action_view"
4- require "active_support/configurable"
54require "view_component/collection"
65require "view_component/compile_cache"
76require "view_component/compiler"
Original file line number Diff line number Diff line change @@ -4,14 +4,30 @@ module ViewComponent
44 module Configurable
55 extend ActiveSupport ::Concern
66
7+ class_methods do
8+ def config
9+ @_config ||= if respond_to? ( :superclass ) && superclass . respond_to? ( :config )
10+ superclass . config . inheritable_copy
11+ else
12+ ActiveSupport ::OrderedOptions . new
13+ end
14+ end
15+
16+ def configure
17+ yield config
18+ end
19+ end
20+
721 included do
822 next if respond_to? ( :config ) && config . respond_to? ( :view_component ) && config . respond_to_missing? ( :instrumentation_enabled )
923
10- include ActiveSupport ::Configurable
11-
1224 configure do |config |
1325 config . view_component ||= ActiveSupport ::InheritableOptions . new
1426 end
27+
28+ def config
29+ self . class . config
30+ end
1531 end
1632 end
1733end
You can’t perform that action at this time.
0 commit comments