Module: Brauser::BrowserMethods::Querying

Included in:
Brauser::Browser
Defined in:
lib/brauser/browser.rb

Overview

Methods to end querying.

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) accepts?(langs = [])

Check if the browser accepts the specified languages.

Parameters:

  • langs (String|Array) (defaults to: [])

    A list of languages to match against.

Returns:

  • (Boolean)

    true if current browser matches, false otherwise.



700
701
702
# File 'lib/brauser/browser.rb', line 700

def accepts?(langs = [])
  self.accepts(langs).result
end

- (Boolean) is?(names = [], versions = {}, platforms = [])

Checks if the browser is a specific name and optionally of a specific version and platform.

Parameters:

  • names (Symbol|Array) (defaults to: [])

    A list of specific names to match. Also, this meta-names are supported: :capable and :tablet.

  • versions (Hash) (defaults to: {})

    An hash with specific version to match against. Need to be in form {:operator => version}, where operator is one of :lt, :lte, :eq, :gt, :gte.

  • platforms (Symbol|Array) (defaults to: [])

    A list of specific platform to match. Valid values are all those possible for the platform attribute.

Returns:

  • (Boolean)

    true if current browser matches, false otherwise.

See Also:



676
677
678
# File 'lib/brauser/browser.rb', line 676

def is?(names = [], versions = {}, platforms = [])
  self.is(names, versions, platforms).result
end

- (Boolean) on?(platforms = [])

Check if the browser is on a specific platform.

Parameters:

  • platforms (Symbol|Array) (defaults to: [])

    A list of specific platform to match.

Returns:

  • (Boolean)

    true if current browser matches, false otherwise.



692
693
694
# File 'lib/brauser/browser.rb', line 692

def on?(platforms = [])
  self.on(platforms).result
end

- (Boolean) v?(versions = {})

Checks if the brower is a specific version.

Parameters:

  • versions (String|Hash) (defaults to: {})

    A string in the form operator version && ... (example: >= 7 && < 4) or an hash with specific version to match against, in form {:operator => version}, where operator is one of :lt, :lte, :eq, :gt, :gte.

Returns:

  • (Boolean)

    true if current browser matches, false otherwise.



684
685
686
# File 'lib/brauser/browser.rb', line 684

def v?(versions = {})
  self.v(versions).result
end