Sha256: 7f30d84b35f02799d73c3ffbffce7583d5031965e3557bb7ad16b42d4377265d

Contents?: true

Size: 810 Bytes

Versions: 3

Compression:

Stored size: 810 Bytes

Contents

module Sniffles
  module Sniffers
    class Invision
      include HTML
      
      attr_accessor :doc
      attr_reader :output
      
      def initialize(response_body)
        @output = {}        
        parse(response_body) && process_document
      end
      
      def process_document
        if @output[:found] = found?
          parse_version
        end
      end
      
      private
      def found?
        !!(copyright_link =~ /Forum Software by IP\.Board/)
      end
      
      def parse_version
        version_capture = (copyright_link.match /Software by IP\.Board ([\d]+\.[\d]+\.[\d]+(?: Beta [\d]+))/)
        @output[:version] = version_capture ? version_capture[1] : false
      end
      
      def copyright_link
        text_at("//p[@id='copyright']/a")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sniffles-0.1.5 lib/sniffles/sniffers/cms/invision.rb
sniffles-0.1.4 lib/sniffles/sniffers/cms/invision.rb
sniffles-0.1.3 lib/sniffles/sniffers/cms/invision.rb