diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 6a74486..176648b 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -755,12 +755,75 @@ 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 + # + # Returns the default accept character set to be used for new \CGI instances; + # 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 + # + # Sets the default accept character set to be used for new \CGI instances; + # returns the argument. + # + # The argument may be an Encoding object or an Encoding name; + # see {Encodings}[https://docs.ruby-lang.org/en/master/language/encodings_rdoc.html]: + # + # # The initial value. + # CGI.accept_charset # => "UTF-8" + # CGI.new + # # => + # # + # + # # Set by Encoding name. + # CGI.accept_charset = 'US-ASCII' # => "US-ASCII" + # CGI.new + # # => + # # + # + # # Set by Encoding object. + # CGI.accept_charset = Encoding::ASCII_8BIT # => # + # CGI.new + # # => + # #, + # @accept_charset_error_block=nil, + # @cookies={}, + # @max_multipart_length=134217728, + # @multipart=false, + # @options={accept_charset: #, max_multipart_length: 134217728}, + # @output_cookies=nil, + # @output_hidden=nil, + # @params={}> + # + # The given encoding is not checked in this method, + # but if it is invalid, a call to CGI.new will fail: + # + # CGI.accept_charset = 'foo' + # CGI.new # Raises ArgumentError: unknown encoding name - foo + # def self.accept_charset=(accept_charset) @@accept_charset=accept_charset end