Class: Selenium::WebDriver::Support::Guards::GuardCondition Private

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/support/guards/guard_condition.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Guard derived from RSpec example metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, condition = nil, &blk) ⇒ GuardCondition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of GuardCondition.


33
34
35
36
37
38
39
40
# File 'lib/selenium/webdriver/support/guards/guard_condition.rb', line 33

def initialize(name, condition = nil, &blk)
  @name = name
  @execution = if block_given?
                 proc(&blk)
               else
                 proc { |guarded| guarded.include?(condition) }
               end
end

Instance Attribute Details

#executionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


31
32
33
# File 'lib/selenium/webdriver/support/guards/guard_condition.rb', line 31

def execution
  @execution
end

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


31
32
33
# File 'lib/selenium/webdriver/support/guards/guard_condition.rb', line 31

def name
  @name
end

Instance Method Details

#satisfied?(guard) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

42
43
44
45
46
# File 'lib/selenium/webdriver/support/guards/guard_condition.rb', line 42

def satisfied?(guard)
  list = Array(guard.guarded[@name])

  list.empty? || @execution.call(list)
end