Class: Gitlab::UrlBlockers::DomainAllowlistEntry
- Inherits:
-
Object
- Object
- Gitlab::UrlBlockers::DomainAllowlistEntry
- Defined in:
- lib/gitlab/url_blockers/domain_allowlist_entry.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(domain, port: nil) ⇒ DomainAllowlistEntry
constructor
A new instance of DomainAllowlistEntry.
- #match?(requested_domain, requested_port = nil) ⇒ Boolean
Constructor Details
#initialize(domain, port: nil) ⇒ DomainAllowlistEntry
Returns a new instance of DomainAllowlistEntry.
8 9 10 11 |
# File 'lib/gitlab/url_blockers/domain_allowlist_entry.rb', line 8 def initialize(domain, port: nil) @domain = domain @port = port end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
6 7 8 |
# File 'lib/gitlab/url_blockers/domain_allowlist_entry.rb', line 6 def domain @domain end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/gitlab/url_blockers/domain_allowlist_entry.rb', line 6 def port @port end |
Instance Method Details
#match?(requested_domain, requested_port = nil) ⇒ Boolean
13 14 15 16 17 18 |
# File 'lib/gitlab/url_blockers/domain_allowlist_entry.rb', line 13 def match?(requested_domain, requested_port = nil) return false unless domain == requested_domain return true if port.nil? port == requested_port end |