Module: CucumberSteps::Browser::ScopeHandler

Included in:
CucumberSteps::Browser
Defined in:
lib/cucumber_steps/browser/scope_handler.rb

Instance Method Summary collapse

Instance Method Details

#add_locating_scope(locating_scope_name, &block) ⇒ Object



13
14
15
16
# File 'lib/cucumber_steps/browser/scope_handler.rb', line 13

def add_locating_scope(locating_scope_name, &block)
  locating_scopes.push([locating_scope_name.to_s.to_sym, block])
  nil
end

#clear_locating_scopes!Object



24
25
26
27
# File 'lib/cucumber_steps/browser/scope_handler.rb', line 24

def clear_locating_scopes!
  locating_scopes.clear
  nil
end

#current_scopeObject



3
4
5
6
7
8
9
10
11
# File 'lib/cucumber_steps/browser/scope_handler.rb', line 3

def current_scope
  target_scope = self

  locating_scopes.each do |location_def|
    target_scope = location_def.call(target_scope)
  end

  target_scope
end

#pop_locating_scope(locating_scope_name) ⇒ Object



18
19
20
21
22
# File 'lib/cucumber_steps/browser/scope_handler.rb', line 18

def pop_locating_scope(locating_scope_name)
  locating_scope_name = locating_scope_name.to_s.to_sym
  locating_scopes.delete_if { |name, block| name == locating_scope_name }
  nil
end