<commit_before>require "iemodal/version"

module IEModal

	def self.included(cls)
		alias_method "page_object_modal_dialog" "modal_dialog"
		define_method("modal_dialog") do |*args|
			return iemodal_watir_modal_dialog(*args) if is_ie_watir_webdriver
			return iemodal_selenium_modal_dialog(*args) if is_ie_selenium_webdriver
			return page_object_modal_dialog(*args) 			
		end
	end		
		
	def iemodal_watir_modial_dialog(&block)
		original_handles = browser.wd.window_handles
		yield if block_given?
		handles = nil
		browser.wait do
  			handles = browser.wd.window_handles
  			handles.size == original_handles.size + 1
		end
		modal = (handles - original_handles).first
		browser.wd.switch_to.window modal
	end
	
	def iemodal_selenium_modal_dialog(&block)
		original_handles = browser.window_handles
		yield if block_given?
		handles = nil
		browser.wait.until do
  			handles = browser.window_handles
  			handles.size == original_handles.size + 1
		end
		modal = (handles - original_handles).first
		browser.switch_to.window modal
	end
	
	def is_ie_watir_webdriver
		return @browser.is_a Watir::Browser and 
			@browser.wd.bridge.is_a Selenium::Webdriver::IE::Bridge
	end
	
	def is_ie_selenium_webdriver
		return @browser.is_a Selenium::WebDriver::Driver and 
			@browser.bridge.is_a Selenium::Webdriver::IE::Bridge
	end

end

<commit_msg>Moved is_ie_watir_webdriver and is_ie_selenium_webdriver to single line functions to avoid "unreachable code"<commit_after>require "iemodal/version"

module IEModal

	def self.included(cls)
		alias_method "page_object_modal_dialog" "modal_dialog"
		define_method("modal_dialog") do |*args|
			return iemodal_watir_modal_dialog(*args) if is_ie_watir_webdriver
			return iemodal_selenium_modal_dialog(*args) if is_ie_selenium_webdriver
			return page_object_modal_dialog(*args) 			
		end
	end		
		
	def iemodal_watir_modial_dialog(&block)
		original_handles = browser.wd.window_handles
		yield if block_given?
		handles = nil
		browser.wait do
  			handles = browser.wd.window_handles
  			handles.size == original_handles.size + 1
		end
		modal = (handles - original_handles).first
		#browser.wd.switch_to.window modal
	end
	
	def iemodal_selenium_modal_dialog(&block)
		original_handles = browser.window_handles
		yield if block_given?
		handles = nil
		browser.wait.until do
  			handles = browser.window_handles
  			handles.size == original_handles.size + 1
		end
		modal = (handles - original_handles).first
		#browser.switch_to.window modal
	end
	
	def is_ie_watir_webdriver
		return (@browser.is_a Watir::Browser and @browser.wd.bridge.is_a Selenium::Webdriver::IE::Bridge)
	end
	
	def is_ie_selenium_webdriver
		return (@browser.is_a Selenium::WebDriver::Driver and @browser.bridge.is_a Selenium::Webdriver::IE::Bridge)
	end

end


{'fraction_non_alphanumeric': 0.07907979870596693, 'fraction_numerical': 0.0014378145219266715, 'mean_word_length': 4.797916666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1623625', 'n_tokens_mistral': 1115, 'n_tokens_neox': 977, 'n_words': 189}