lib/spidr/page/content_types.rb
def is_content_type?(type)
      if type.include?('/')
        # otherwise only match the first param
        content_types.any? do |value|
          value = value.split(';',2).first

          value == type
        end
      else
        # otherwise only match the sub-type
        content_types.any? do |value|
          value = value.split(';',2).first
          value = value.split('/',2).last

          value == type
        end
      end
    end
def is_content_type?(type)
      if type.include?('/')
        # otherwise only match the first param
        content_types.any? do |value|
          value = value.split(';',2).first

          value == type
        end
      else
        # otherwise only match the sub-type
        content_types.any? do |value|
          value = value.split(';',2).first
          value = value.split('/',2).last

          value == type
        end
      end
    end
def is_content_type? ( type ) if type . include? ( '/' ) # otherwise only match the first param content_types . any? do | value | value = value . split ( ';' , 2 ) . first value == type end else # otherwise only match the sub-type content_types . any? do | value | value = value . split ( ';' , 2 ) . first value = value . split ( '/' , 2 ) . last value == type end end end
Determines if any of the content-types of the page include a given
 type.

 @param [String] type
   The content-type to test for.

 @return [Boolean]
   Specifies whether the page includes the given content-type.

 @example Match the Content-Type
   page.is_content_type?('application/json')

 @example Match the sub-type of the Content-Type
   page.is_content_type?('json')

 @since 0.4.0
Determines if any of the content - types of the page include a given type .