Sha256: 771d9b068b4fcd365dcdb1100f55ae432dc94176adcf03ce1ab1c3e3cab1d0f4

Contents?: true

Size: 721 Bytes

Versions: 3

Compression:

Stored size: 721 Bytes

Contents

module Sniffles
  module Sniffers
    class Joomla
      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?
        !!(meta_generator_content =~ /Joomla!/)
      end
      
      def parse_version
        @output[:version] = (meta_generator_content =~ /Joomla! ([\d]+\.[\d]+)/ ? $1 : false)
      end

      def meta_generator_content
        text_at("//meta[@name='generator']/@content")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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