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

Inherits:
Object
  • Object
show all
Defined in:
rb/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.



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

def initialize(name, condition = nil, &blk)
  @name = name
  @execution = if blk
                 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.



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

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.



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

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)


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

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

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