Class: DeviceAtlas::Device::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/deviceatlas/device/config.rb

Overview

DeviceApi Configurations. To change the default configs of the DeviceAtlas DeviceApi create an instance of this class, set your preferred configs and pass the instance to the constructor of a DeviceApi or DeviceApiWeb.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeviceAtlas::Device::Config

Creates a new instance of Config

Examples:

Create an object

config = DeviceAtlas::Device::Config.new
config.include_ua_props = false

Instance Attribute Details

To change the cookie name that the client side properties would be set to. If you want the client side properties to be used add the DeviceAtlas client side component (JS lib) to your web-site pages.

Returns:

  • (String)

    the name of the Cookie

#include_lang_propsBoolean

To check the Accept-Language header and include properties to the property set for getting client's language and locale preferences set to true. If you do not use this properties you can set this config to false to make the detection marginally faster.

Returns:

  • (Boolean)

    whether to include language properties

#include_match_infoBoolean

To include the matched and unmatched parts of the User-Agent to the property set.

Returns:

  • (Boolean)

    whether to include debug properties

#include_ua_propsBoolean

To disable or enable DeviceApi.properties including User-Agent dynamic properties. Some properties cannot be known before runtime and can change from User-Agent to User-Agent. The most common of these are the OS Version and the Browser Version. The DeviceApi is able to dynamically detect these changing properties with a small overhead. If you do not use this properties you can set this config to false to make the detection a little bit faster.

Returns:

  • (Boolean)

    whether to include User-Agent dynamic properties

#max_cache_entriesInteger

Number of results to be kept in a cache buffer. Depending on the frequency and distance factor of your User-Agents or headers passed to the API for detection, increasing the result cache may increase performance by preventing repeated lookups. For a large set of inputs (i.e. an almost unique set of user-agents) set to lower numbers or zero to disable.

Returns:

  • (Integer)

    max number of results to be cached

#return_nil_when_no_propertiesBoolean

The default config value for DeviceApi.properties when there are no properties.

Returns:

  • (Boolean)

    whether to return nil when no properties were detected

Instance Method Details

#is_cache_enabledObject