<commit_before>module Browser

# Class that represents the browser attributes.
class Navigator
  include Native::Base

  Version = Struct.new(:major, :minor, :build)
  Product = Struct.new(:name, :version)
  Vendor  = Struct.new(:name, :version)

  # Class that represents a MIME type.
  class MimeType
    include Native::Base

    # Get the plugin for the MIME type.
    #
    # @!parse attr_reader :plugin
    # @return [Plugin]
    def plugin
      Plugin.new(`#@native.enabledPlugin`)
    end

    # Get the description for the MIME type.
    #
    # @!parse attr_reader :description
    # @return [String]
    alias_native :description

    # Extensions for this MIME type.
    #
    # @!parse attr_reader :extensions
    # @return [Array<String>]
    def extensions
      `#@native.suffixes`.split(/\s*/)
    end

    # The MIME type.
    #
    # @!parse attr_reader :type
    # @return [String]
    alias_native :type
  end

  # Class to represent a browser plugin.
  class Plugin < Native::Array
    def initialize(plugin)
      # FIXME: uncomment these
      #super plugin do |m|
        #MimeType.new(m)
      #end
    end

    # Get the plugin description.
    #
    # @!parse attr_reader :description
    # @return [String]
    alias_native :description

    # Get the file associated to the plugin.
    #
    # @!parse attr_reader :file
    # @return [String]
    alias_native :file, :filename

    # Get the plugin name.
    #
    # @!parse attr_reader :name
    # @return [String]
    alias_native :name

    # Get the plugin version.
    #
    # @!parse attr_reader :version
    # @return [String]
    alias_native :version
  end

  # Get the browser code name.
  #
  # @!parse attr_reader :code
  # @return [String]
  alias_native :code, :appCodeName

  # Get the browser name.
  #
  # @!parse attr_reader :name
  # @return [String]
  alias_native :name, :appName

  # Get the browser {Version}.
  #
  # @!parse attr_reader :version
  # @return [Version]
  def version
    Version.new(`#@native.appVersion`, `#@native.appMinorVersion`, `#@native.buildID`)
  end

  # Check if cookies are enabled.
  alias_native :cookies?, :cookieEnabled

  # Check if DNT is disabled.
  def track?
    `!#@native.doNotTrack`
  end

  # Check the browser language.
  #
  # @!parse attr_reader :language
  # @return [String]
  alias_native :language

  # Check the supported MIME types.
  #
  # @!parse attr_reader :mime_types
  # @return [Native::Array<MimeType>]
  def mime_types
    Native::Array.new `#@native.mimeTypes`, get: :item, named: :namedItem do |m|
      MimeType.new(m)
    end
  end

  # Check if the browser is in offline mode.
  def offline?
    `!#@native.onLine`
  end

  # Get the operating system the browser is running on.
  #
  # @!parse attr_reader :operating_system
  # @return [String]
  alias_native :operating_system, :oscpu

  alias os operating_system

  # Get the platform the browser is running on.
  #
  # @!parse attr_reader :platform
  # @return [String]
  alias_native :platform

  # Get enabled plugins.
  #
  # @!parse attr_reader :plugins
  # @return [Native::Array<Plugin>]
  def plugins
    Native::Array.new `#@native.plugins` do |p|
      Plugin.new(p)
    end
  end

  # Get the product name and version.
  #
  # @!parse attr_reader :product
  # @return [Product]
  def product
    Product.new(`#@native.product`, `#@native.productSub`)
  end

  alias_native :user_agent, :userAgent

  # Get the vendor name and version.
  #
  # @!parse attr_reader :vendor
  # @return [Vendor]
  def vendor
    Vendor.new(`#@native.vendor`, `#@naive.vendorSub`)
  end

  # Check if Java is enabled.
  def java?
    `#@native.javaEnabled()`<commit_msg>navigator: more documentation fixes and improvements<commit_after>module Browser

# Class that represents the browser attributes.
class Navigator
  include Native::Base

  Version = Struct.new(:major, :minor, :build)
  Product = Struct.new(:name, :version)
  Vendor  = Struct.new(:name, :version)

  # Class that represents a MIME type.
  class MimeType
    include Native::Base

    # @!attribute [r] plugin
    # @return [Plugin] the plugin for the MIME type
    def plugin
      Plugin.new(`#@native.enabledPlugin`)
    end

    # @!attribute [r] description
    # @return [String] the description for the MIME type
    alias_native :description

    # @!attribute [r] extensions
    # @return [Array<String>] the extensions for this MIME type
    def extensions
      `#@native.suffixes`.split(/\s*/)
    end

    # @!attribute [r] type
    # @return [String] the MIME type
    alias_native :type
  end

  # Class to represent a browser plugin.
  class Plugin < Native::Array
    def initialize(plugin)
      # FIXME: uncomment these
      #super plugin do |m|
        #MimeType.new(m)
      #end
    end

    # @!attribute [r] description
    # @return [String] the plugin description
    alias_native :description

    # @!attribute [r] file
    # @return [String] the file associated with the plugin
    alias_native :file, :filename

    # @!attribute [r] name
    # @return [String] the plugin name
    alias_native :name

    # @!attribute [r] version
    # @return [String] the plugin version
    alias_native :version
  end

  # @!attribute [r] code
  # @return [String] the browser code name
  alias_native :code, :appCodeName

  # @!attribute [r] name
  # @return [String] the browser name
  alias_native :name, :appName

  # @!attribute [r] version
  # @return [Version] the browser version
  def version
    Version.new(`#@native.appVersion`, `#@native.appMinorVersion`, `#@native.buildID`)
  end

  # Check if cookies are enabled.
  alias_native :cookies?, :cookieEnabled

  # Check if DNT is disabled.
  def track?
    `!#@native.doNotTrack`
  end

  # @!attribute [r] language
  # @return [String] the browser language
  alias_native :language

  # @!attribute [r] mime_types
  # @return [Native::Array<MimeType>] the supported MIME types
  def mime_types
    Native::Array.new `#@native.mimeTypes`, get: :item, named: :namedItem do |m|
      MimeType.new(m)
    end
  end

  # Check if the browser is in offline mode.
  def offline?
    `!#@native.onLine`
  end

  # @!attribute [r] operating_system
  # @return [String] the operating system the browser is running on
  alias_native :operating_system, :oscpu

  alias os operating_system

  # @!attribute [r] platform
  # @return [String] the platform the browser is running on
  alias_native :platform

  # @!attribute [r] plugins
  # @return [Native::Array<Plugin>] the enabled plugins
  def plugins
    Native::Array.new `#@native.plugins` do |p|
      Plugin.new(p)
    end
  end

  # @!attribute [r] product
  # @return [Product] the product name and version
  def product
    Product.new(`#@native.product`, `#@native.productSub`)
  end

  # @!attribute [r] user_agent
  # @return [String] the browser's user agent
  alias_native :user_agent, :userAgent

  # @!attribute [r] vendor
  # @return [Vendor] the vendor name and version
  def vendor
    Vendor.new(`#@native.vendor`, `#@native.vendorSub`)
  end

  # Check if Java is enabled.
  def java?
    `#@native.javaEnabled()`
{'fraction_non_alphanumeric': 0.11313612785644189, 'fraction_numerical': 0.0, 'mean_word_length': 3.0976450315910395, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1276742', 'n_tokens_mistral': 2351, 'n_tokens_neox': 2269, 'n_words': 709}