lib/public_suffix/rule.rb in public_suffix-4.0.7 vs lib/public_suffix/rule.rb in public_suffix-5.0.0

- old
+ new

@@ -123,11 +123,11 @@ # # @param value [String] # @param private [Boolean] def initialize(value:, length: nil, private: false) @value = value.to_s - @length = length || @value.count(DOT) + 1 + @length = length || (@value.count(DOT) + 1) @private = private end # Checks whether this rule is equal to <tt>other</tt>. # @@ -159,11 +159,11 @@ # # => false # # @param name [String] the domain name to check # @return [Boolean] def match?(name) - # Note: it works because of the assumption there are no + # NOTE: it works because of the assumption there are no # rules like foo.*.com. If the assumption is incorrect, # we need to properly walk the input and skip parts according # to wildcard component. diff = name.chomp(value) diff.empty? || diff.end_with?(DOT) @@ -219,11 +219,11 @@ # Initializes a new rule from the content. # # @param content [String] the content of the rule # @param private [Boolean] def self.build(content, private: false) - new(value: content.to_s[2..-1], private: private) + new(value: content.to_s[2..], private: private) end # Initializes a new rule. # # @param value [String] @@ -267,11 +267,11 @@ # Initializes a new rule from the content. # # @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) + new(value: content.to_s[1..], private: private) end # Gets the original rule definition. # # @return [String] The rule definition. @@ -297,10 +297,10 @@ # If the prevailing rule is a exception rule, # modify it by removing the leftmost label. # # @return [Array<String>] def parts - @value.split(DOT)[1..-1] + @value.split(DOT)[1..] end end