Class: Gem::Uri
- Inherits:
-
Object
show all
- Defined in:
- lib/rubygems/uri.rb
Overview
The Uri handles rubygems source URIs.
Instance Method Summary
collapse
Constructor Details
#initialize(source_uri) ⇒ Uri
Returns a new instance of Uri.
8
9
10
|
# File 'lib/rubygems/uri.rb', line 8
def initialize(source_uri)
@parsed_uri = parse(source_uri)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &blk) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/rubygems/uri.rb', line 34
def method_missing(method_name, *args, &blk)
if @parsed_uri.respond_to?(method_name)
@parsed_uri.send(method_name, *args, &blk)
else
super
end
end
|
Instance Method Details
#redact_credentials_from(text) ⇒ Object
28
29
30
31
32
|
# File 'lib/rubygems/uri.rb', line 28
def redact_credentials_from(text)
return text unless valid_uri? && password?
text.sub(password, 'REDACTED')
end
|
#redacted ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/rubygems/uri.rb', line 12
def redacted
return self unless valid_uri?
if token? || oauth_basic?
with_redacted_user
elsif password?
with_redacted_password
else
self
end
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
42
43
44
|
# File 'lib/rubygems/uri.rb', line 42
def respond_to_missing?(method_name, include_private = false)
@parsed_uri.respond_to?(method_name, include_private) || super
end
|
#to_s ⇒ Object
24
25
26
|
# File 'lib/rubygems/uri.rb', line 24
def to_s
@parsed_uri.to_s
end
|