Sha256: f9383e2bdf25c3d06f7a78271faa46fa655171dd6a626360d813a2676983f165

Contents?: true

Size: 698 Bytes

Versions: 2

Compression:

Stored size: 698 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

2 entries across 2 versions & 1 rubygems

Version Path
browser-6.1.0 lib/browser/meta/base.rb
browser-6.0.0 lib/browser/meta/base.rb