From 32e96adc13b963584c8898f5d990d1c3adf1f365 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sat, 27 Sep 2025 23:16:34 +0100 Subject: [PATCH] [DOC] Tweaks for CGI.accept_charset and CGI.accept_charset= --- lib/cgi/core.rb | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index e6c19bb..8e2067c 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -755,12 +755,38 @@ class InvalidEncoding < Exception; end # @@accept_charset="UTF-8" if false # needed for rdoc? - # Return the accept character set for all new CGI instances. + # :call-seq: + # CGI.accept_charset -> encoding_or_encoding_name + # + # Returns the accept character set for any new \CGI instance; + # see CGI.accept_charset=. def self.accept_charset @@accept_charset end - # Set the accept character set for all new CGI instances. + # :call-seq: + # CGI.accept_charset = encoding_or_encoding_name + # + # Sets the accept character set for any new \CGI instance; + # returns the argument. + # + # Argument +encoding_or_encoding_name+ may be + # an {Encoding object}[https://docs.ruby-lang.org/en/master/encodings_rdoc.html#label-Encoding+Objects] + # or an {encoding name}[https://docs.ruby-lang.org/en/master/encodings_rdoc.html#label-Names+and+Aliases]: + # + # require 'cgi' + # CGI.accept_charset # => "UTF-8" + # CGI.accept_charset = Encoding::UTF_8 + # CGI.accept_charset # => # + # CGI.accept_charset = 'UTF-8' + # CGI.accept_charset # => "UTF-8" + # + # Note that the argument is stored "as is," + # and is not checked for validity: + # + # CGI.accept_charset = Object.new + # CGI.accept_charset # => # + # def self.accept_charset=(accept_charset) @@accept_charset=accept_charset end