HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/ruby/vendor_ruby/webrobots/nokogiri.rb
require 'nokogiri'

class Nokogiri::HTML::Document
  # Returns an array of lower-cased <meta name="ROBOTS"> tokens.  If
  # no tag is found, returns an empty array.  An optional
  # +custom_name+ specifies the name of a meta tag to look for ahead
  # of "ROBOTS".  Names are compared in a case-insensitive manner.
  def meta_robots(custom_name = nil)
    (@meta_robots ||= {})[custom_name] =
      (custom_name && parse_meta_robots(custom_name)) || parse_meta_robots('robots')
  end

  # Equivalent to meta_robots(custom_name).include?('noindex').
  def noindex?(custom_name = nil)
    meta_robots(custom_name).include?('noindex')
  end

  # Equivalent to meta_robots(custom_name).include?('nofollow').
  def nofollow?(custom_name = nil)
    meta_robots(custom_name).include?('nofollow')
  end

  private

  def parse_meta_robots(custom_name)
    pattern = /\A#{Regexp.quote(custom_name)}\z/i
    meta = css('meta[@name]').find { |element|
      element['name'].match(pattern)
    } and content = meta['content'] or return []
    content.downcase.split(/[,\s]+/)
  end
end