Skip to content

Commit

Permalink
[DOC] Make documentation 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jan 23, 2025
1 parent aa45e72 commit fe7aa3d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions .document
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
BSDL
COPYING
README.md
docs/
lib/
2 changes: 2 additions & 0 deletions docs/kernel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# :stopdoc:
module Kernel end
10 changes: 7 additions & 3 deletions lib/uri/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
require_relative "rfc3986_parser"

module URI
# The default parser instance for RFC 2396.
RFC2396_PARSER = RFC2396_Parser.new
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)

# The default parser instance for RFC 3986.
RFC3986_PARSER = RFC3986_Parser.new
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)

# The default parser instance.
DEFAULT_PARSER = RFC3986_PARSER
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)

# Set the default parser instance.
def self.parser=(parser = RFC3986_PARSER)
remove_const(:Parser) if defined?(::URI::Parser)
const_set("Parser", parser.class)
Expand All @@ -40,7 +44,7 @@ def self.parser=(parser = RFC3986_PARSER)
end
self.parser = RFC3986_PARSER

def self.const_missing(const)
def self.const_missing(const) # :nodoc:
if const == :REGEXP
warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
URI::RFC2396_REGEXP
Expand Down Expand Up @@ -87,7 +91,7 @@ def make_components_hash(klass, array_hash)
module_function :make_components_hash
end

module Schemes
module Schemes # :nodoc:
end
private_constant :Schemes

Expand Down Expand Up @@ -305,7 +309,7 @@ def self.regexp(schemes = nil)# :nodoc:
256.times do |i|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
end
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
TBLENCWWWCOMP_[' '] = '+'
TBLENCWWWCOMP_.freeze
TBLDECWWWCOMP_ = {} # :nodoc:
Expand Down
8 changes: 5 additions & 3 deletions lib/uri/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,12 @@ def check_registry(v) # :nodoc:
end
private :check_registry

def set_registry(v) #:nodoc:
def set_registry(v) # :nodoc:
raise InvalidURIError, "cannot set registry"
end
protected :set_registry

def registry=(v)
def registry=(v) # :nodoc:
raise InvalidURIError, "cannot set registry"
end

Expand Down Expand Up @@ -1392,10 +1392,12 @@ def ==(oth)
end
end

# Returns the hash value.
def hash
self.component_ary.hash
end

# Compares with _oth_ for Hash.
def eql?(oth)
self.class == oth.class &&
parser == oth.parser &&
Expand Down Expand Up @@ -1438,7 +1440,7 @@ def select(*components)
end
end

def inspect
def inspect # :nodoc:
"#<#{self.class} #{self}>"
end

Expand Down
12 changes: 6 additions & 6 deletions lib/uri/rfc2396_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@ def unescape(str, escaped = @regexp[:ESCAPED])
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end

@@to_s = Kernel.instance_method(:to_s)
if @@to_s.respond_to?(:bind_call)
def inspect
@@to_s.bind_call(self)
TO_S = Kernel.instance_method(:to_s) # :nodoc:
if TO_S.respond_to?(:bind_call)
def inspect # :nodoc:
TO_S.bind_call(self)
end
else
def inspect
@@to_s.bind(self).call
def inspect # :nodoc:
TO_S.bind(self).call
end
end

Expand Down

0 comments on commit fe7aa3d

Please sign in to comment.