Sha256: 0c8fffe9f604043733a95a479d49413802312f7533ac22705ff08372088b4b6f

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

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