@@ -19,7 +19,7 @@ def nonced_style_tag(content_or_options = {}, &block)
1919 #
2020 # Returns an html-safe link tag with the nonce attribute.
2121 def nonced_stylesheet_link_tag ( *args , &block )
22- opts = extract_options ( args ) . merge ( nonce : content_security_policy_nonce ( :style ) )
22+ opts = extract_options ( args ) . merge ( nonce : _content_security_policy_nonce ( :style ) )
2323
2424 stylesheet_link_tag ( *args , opts , &block )
2525 end
@@ -37,7 +37,7 @@ def nonced_javascript_tag(content_or_options = {}, &block)
3737 #
3838 # Returns an html-safe script tag with the nonce attribute.
3939 def nonced_javascript_include_tag ( *args , &block )
40- opts = extract_options ( args ) . merge ( nonce : content_security_policy_nonce ( :script ) )
40+ opts = extract_options ( args ) . merge ( nonce : _content_security_policy_nonce ( :script ) )
4141
4242 javascript_include_tag ( *args , opts , &block )
4343 end
@@ -47,7 +47,7 @@ def nonced_javascript_include_tag(*args, &block)
4747 #
4848 # Returns an html-safe script tag with the nonce attribute.
4949 def nonced_javascript_pack_tag ( *args , &block )
50- opts = extract_options ( args ) . merge ( nonce : content_security_policy_nonce ( :script ) )
50+ opts = extract_options ( args ) . merge ( nonce : _content_security_policy_nonce ( :script ) )
5151
5252 javascript_pack_tag ( *args , opts , &block )
5353 end
@@ -57,7 +57,7 @@ def nonced_javascript_pack_tag(*args, &block)
5757 #
5858 # Returns an html-safe link tag with the nonce attribute.
5959 def nonced_stylesheet_pack_tag ( *args , &block )
60- opts = extract_options ( args ) . merge ( nonce : content_security_policy_nonce ( :style ) )
60+ opts = extract_options ( args ) . merge ( nonce : _content_security_policy_nonce ( :style ) )
6161
6262 stylesheet_pack_tag ( *args , opts , &block )
6363 end
@@ -66,21 +66,22 @@ def nonced_stylesheet_pack_tag(*args, &block)
6666 # Instructs secure_headers to append a nonce to style/script-src directives.
6767 #
6868 # Returns a non-html-safe nonce value.
69- def content_security_policy_nonce ( type )
69+ def _content_security_policy_nonce ( type )
7070 case type
7171 when :script
7272 SecureHeaders . content_security_policy_script_nonce ( @_request )
7373 when :style
7474 SecureHeaders . content_security_policy_style_nonce ( @_request )
7575 end
7676 end
77+ alias_method :content_security_policy_nonce , :_content_security_policy_nonce
7778
7879 def content_security_policy_script_nonce
79- content_security_policy_nonce ( :script )
80+ _content_security_policy_nonce ( :script )
8081 end
8182
8283 def content_security_policy_style_nonce
83- content_security_policy_nonce ( :style )
84+ _content_security_policy_nonce ( :style )
8485 end
8586
8687 ##
@@ -152,7 +153,7 @@ def nonced_tag(type, content_or_options, block)
152153 else
153154 content_or_options . html_safe # :'(
154155 end
155- content_tag type , content , options . merge ( nonce : content_security_policy_nonce ( type ) )
156+ content_tag type , content , options . merge ( nonce : _content_security_policy_nonce ( type ) )
156157 end
157158
158159 def extract_options ( args )
0 commit comments