Skip to content

Commit a151e56

Browse files
committed
rb: Add Service#host accessor to avoid hacking instance variables
1 parent 7143ecc commit a151e56

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

rb/lib/selenium/webdriver/common/service.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class Service
3737
SOCKET_LOCK_TIMEOUT = 45
3838
STOP_TIMEOUT = 5
3939

40+
attr_accessor :host
41+
4042
def initialize(executable_path, port, *extra_args)
4143
@executable_path = executable_path
4244
@host = Platform.localhost

rb/lib/selenium/webdriver/edge/bridge.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,20 @@ module Selenium
2121
module WebDriver
2222
module Edge
2323

24+
#
2425
# @api private
26+
#
27+
2528
class Bridge < Remote::W3CBridge
2629

2730
def initialize(opts = {})
28-
2931
http_client = opts.delete(:http_client)
3032

3133
if opts.has_key?(:url)
3234
url = opts.delete(:url)
3335
else
3436
@service = Service.new(Edge.driver_path, Service::DEFAULT_PORT, *extract_service_args(opts))
35-
36-
if @service.instance_variable_get("@host") == "127.0.0.1"
37-
@service.instance_variable_set("@host", 'localhost')
38-
end
39-
37+
@service.host = 'localhost' if @service.host == '127.0.0.1'
4038
@service.start
4139

4240
url = @service.uri

0 commit comments

Comments
 (0)