Class: Brauser::Query

Inherits:
Object
  • Object
show all
Includes:
Brauser::Queryable::Chainers, Brauser::Queryable::Queries
Defined in:
lib/brauser/query.rb

Overview

A query to a browser. This class enables concatenation, like:

Brauser::Browser.new.is(:msie).version(">= 7").on?(:windows)

To end concatenation, use the ? form of the queries or call .result.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Brauser::Queryable::Queries

#accepts?, #is?, #on?, #version?

Methods included from Brauser::Queryable::Chainers

#accepts, #is, #on, #version

Constructor Details

#initialize(target, result = true) ⇒ Query

Creates a new query.

Parameters:

  • target (Browser)

    The current browser.

  • result (Boolean) (defaults to: true)

    The current result.



31
32
33
34
# File 'lib/brauser/query.rb', line 31

def initialize(target, result = true)
  @target = target
  @result = result
end

Instance Attribute Details

#resultBoolean

Returns The current result.

Returns:

  • (Boolean)

    The current result.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/brauser/query.rb', line 20

class Query
  attr_accessor :target
  attr_accessor :result

  include Brauser::Queryable::Chainers
  include Brauser::Queryable::Queries

  # Creates a new query.
  #
  # @param target [Browser] The current browser.
  # @param result [Boolean] The current result.
  def initialize(target, result = true)
    @target = target
    @result = result
  end
end

#targetBrowser

Returns The current browser.

Returns:

  • (Browser)

    The current browser.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/brauser/query.rb', line 20

class Query
  attr_accessor :target
  attr_accessor :result

  include Brauser::Queryable::Chainers
  include Brauser::Queryable::Queries

  # Creates a new query.
  #
  # @param target [Browser] The current browser.
  # @param result [Boolean] The current result.
  def initialize(target, result = true)
    @target = target
    @result = result
  end
end