Sha256: 139d35f3ee1af306d2efe7e4d98dd401ea1c553008dbafa7662d2e22734413d8

Contents?: true

Size: 703 Bytes

Versions: 8

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module Browser
  module Meta
    def self.rules
      @rules ||= [
        Device,
        GenericBrowser,
        Id,
        IE,
        IOS,
        Mobile,
        Platform,
        Proxy,
        Safari,
        Tablet,
        Webkit
      ]
    end

    def self.get(browser)
      rules.each_with_object(Set.new) do |rule, meta|
        meta.merge(rule.new(browser).to_a)
      end.to_a
    end

    class Base
      # Set the browser instance.
      attr_reader :browser

      def initialize(browser)
        @browser = browser
      end

      def meta
        nil
      end

      def to_a
        meta.to_s.squeeze(" ").split(" ")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
browser-5.3.1 lib/browser/meta/base.rb
browser-5.3.0 lib/browser/meta/base.rb
browser-5.2.0 lib/browser/meta/base.rb
browser-5.1.0 lib/browser/meta/base.rb
browser-5.0.0 lib/browser/meta/base.rb
browser-4.2.0 lib/browser/meta/base.rb
browser-4.1.0 lib/browser/meta/base.rb
browser-4.0.0 lib/browser/meta/base.rb