Class: Brauser::Query

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

Overview

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

Brauser::Browser.new.is(:msie).v(">= 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 Queries

#accepts?, #is?, #on?, #v?

Methods included from Chainers

#accepts, #is, #on, #v

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.



124
125
126
127
# File 'lib/brauser/query.rb', line 124

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

Instance Attribute Details

#resultBoolean

Returns The current result.

Returns:

  • (Boolean)

    The current result.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/brauser/query.rb', line 113

class Query
  attr_accessor :target
  attr_accessor :result

  include Brauser::Chainers
  include Brauser::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.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/brauser/query.rb', line 113

class Query
  attr_accessor :target
  attr_accessor :result

  include Brauser::Chainers
  include Brauser::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