Skip to content

Commit

Permalink
Fixed YARD rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Apr 12, 2022
1 parent 434f0bd commit b741b4f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
This project uses [Semantic Versioning 2.0.0](https://semver.org/).


## master

### Fixes

- Fixed YARD rake task (GH-179)


## 4.0.6

### Changed
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require "rubocop/rake_task"
RuboCop::RakeTask.new


require "yard"
require "yard/rake/yardoc_task"

YARD::Rake::YardocTask.new(:yardoc) do |y|
Expand Down
22 changes: 10 additions & 12 deletions lib/public_suffix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,13 @@ module PublicSuffix
# # => PublicSuffix::DomainInvalid: http://www.google.com is not expected to contain a scheme
#
#
# @param [String, #to_s] name The domain name or fully qualified domain name to parse.
# @param [PublicSuffix::List] list The rule list to search, defaults to the default {PublicSuffix::List}
# @param [Boolean] ignore_private
# @param name [#to_s] The domain name or fully qualified domain name to parse.
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
# @param ignore_private [Boolean]
# @return [PublicSuffix::Domain]
#
# @raise [PublicSuffix::DomainInvalid]
# If domain is not a valid domain.
# @raise [PublicSuffix::DomainNotAllowed]
# If a rule for +domain+ is found, but the rule doesn't allow +domain+.
# @raise [PublicSuffix::DomainInvalid] If domain is not a valid domain.
# @raise [PublicSuffix::DomainNotAllowed] If a rule for +domain+ is found, but the rule doesn't allow +domain+.
def self.parse(name, list: List.default, default_rule: list.default_rule, ignore_private: false)
what = normalize(name)
raise what if what.is_a?(DomainInvalid)
Expand Down Expand Up @@ -119,8 +117,8 @@ def self.parse(name, list: List.default, default_rule: list.default_rule, ignore
# # => false
#
#
# @param [String, #to_s] name The domain name or fully qualified domain name to validate.
# @param [Boolean] ignore_private
# @param name [#to_s] The domain name or fully qualified domain name to validate.
# @param ignore_private [Boolean]
# @return [Boolean]
def self.valid?(name, list: List.default, default_rule: list.default_rule, ignore_private: false)
what = normalize(name)
Expand All @@ -135,9 +133,9 @@ def self.valid?(name, list: List.default, default_rule: list.default_rule, ignor
#
# This method doesn't raise. Instead, it returns nil if the domain is not valid for whatever reason.
#
# @param [String, #to_s] name The domain name or fully qualified domain name to parse.
# @param [PublicSuffix::List] list The rule list to search, defaults to the default {PublicSuffix::List}
# @param [Boolean] ignore_private
# @param name [#to_s] The domain name or fully qualified domain name to parse.
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
# @param ignore_private [Boolean]
# @return [String]
def self.domain(name, **options)
parse(name, **options).domain
Expand Down
2 changes: 1 addition & 1 deletion lib/public_suffix/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.default=(value)
#
# See http://publicsuffix.org/format/ for more details about input format.
#
# @param string [#each_line] the list to parse
# @param input [#each_line] the list to parse
# @param private_domains [Boolean] whether to ignore the private domains section
# @return [PublicSuffix::List]
def self.parse(input, private_domains: true)
Expand Down
20 changes: 10 additions & 10 deletions lib/public_suffix/rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ def initialize(value:, length: nil, private: false)

# Checks whether this rule is equal to <tt>other</tt>.
#
# @param [PublicSuffix::Rule::*] other The rule to compare
# @return [Boolean]
# Returns true if this rule and other are instances of the same class
# and has the same value, false otherwise.
# @param other [PublicSuffix::Rule::*] The rule to compare
# @return [Boolean] true if this rule and other are instances of the same class
# and has the same value, false otherwise.
def ==(other)
equal?(other) || (self.class == other.class && value == other.value)
end
Expand Down Expand Up @@ -176,7 +175,7 @@ def parts
end

# @abstract
# @param [String, #to_s] name The domain name to decompose
# @param domain [#to_s] The domain name to decompose
# @return [Array<String, nil>]
def decompose(*)
raise NotImplementedError
Expand All @@ -196,7 +195,7 @@ def rule

# Decomposes the domain name according to rule properties.
#
# @param [String, #to_s] name The domain name to decompose
# @param domain [#to_s] The domain name to decompose
# @return [Array<String>] The array with [trd + sld, tld].
def decompose(domain)
suffix = parts.join('\.')
Expand Down Expand Up @@ -228,6 +227,7 @@ def self.build(content, private: false)
# Initializes a new rule.
#
# @param value [String]
# @param length [Integer]
# @param private [Boolean]
def initialize(value:, length: nil, private: false)
super(value: value, length: length, private: private)
Expand All @@ -243,7 +243,7 @@ def rule

# Decomposes the domain name according to rule properties.
#
# @param [String, #to_s] name The domain name to decompose
# @param domain [#to_s] The domain name to decompose
# @return [Array<String>] The array with [trd + sld, tld].
def decompose(domain)
suffix = ([".*?"] + parts).join('\.')
Expand All @@ -266,7 +266,7 @@ class Exception < Base

# Initializes a new rule from the content.
#
# @param content [String] the content of the rule
# @param content [#to_s] the content of the rule
# @param private [Boolean]
def self.build(content, private: false)
new(value: content.to_s[1..-1], private: private)
Expand All @@ -281,7 +281,7 @@ def rule

# Decomposes the domain name according to rule properties.
#
# @param [String, #to_s] name The domain name to decompose
# @param domain [#to_s] The domain name to decompose
# @return [Array<String>] The array with [trd + sld, tld].
def decompose(domain)
suffix = parts.join('\.')
Expand Down Expand Up @@ -321,7 +321,7 @@ def parts
# PublicSuffix::Rule.factory("!congresodelalengua3.ar")
# # => #<PublicSuffix::Rule::Exception>
#
# @param [String] content The rule content.
# @param content [#to_s] the content of the rule
# @return [PublicSuffix::Rule::*] A rule instance.
def self.factory(content, private: false)
case content.to_s[0, 1]
Expand Down

0 comments on commit b741b4f

Please sign in to comment.