class Selenium::WebDriver::Support::Guards

def collect_example_guards

def collect_example_guards
  guards = []
  GUARD_TYPES.each do |guard_type|
    example_group = @example.metadata[:example_group]
    example_guards = [@example.metadata[guard_type], example_group[guard_type]]
    while example_group[:parent_example_group]
      example_group = example_group[:parent_example_group]
      example_guards << example_group[guard_type]
    end
    example_guards.flatten.uniq.compact.each do |example_guard|
      guards << Guard.new(example_guard, guard_type, self)
    end
  end
  guards
end