Class: HoldFirefox::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/hold_firefox.rb

Instance Method Summary collapse

Constructor Details

#initialize(platform) ⇒ Path

Returns a new instance of Path.



6
7
8
9
10
# File 'lib/hold_firefox.rb', line 6

def initialize(platform)
  @platform = platform
  return unless allowed?
  Selenium::WebDriver::Firefox::Binary.path = firefox_path
end

Instance Method Details

#allowed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/hold_firefox.rb', line 25

def allowed?
  @platform =~ /linux/i || @platform =~ /darwin/i
end

#firefox_pathObject



17
18
19
20
21
22
23
# File 'lib/hold_firefox.rb', line 17

def firefox_path
  if @platform =~ /linux/i
    home.join('firefox', 'firefox-bin').to_s
  elsif @platform =~ /darwin/i
    home.join('Firefox.app', 'Contents', 'MacOS', 'firefox-bin').to_s
  end
end

#homeObject

Folder path



13
14
15
# File 'lib/hold_firefox.rb', line 13

def home
  Pathname.new(File.dirname(__FILE__)).join('..', 'ext', 'hold_firefox')
end