Class: HoldFirefox::Path
- Inherits:
-
Object
- Object
- HoldFirefox::Path
- Defined in:
- lib/hold_firefox.rb
Instance Method Summary collapse
- #allowed? ⇒ Boolean
- #firefox_path ⇒ Object
-
#home ⇒ Object
Folder path.
-
#initialize(platform) ⇒ Path
constructor
A new instance of Path.
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
25 26 27 |
# File 'lib/hold_firefox.rb', line 25 def allowed? @platform =~ /linux/i || @platform =~ /darwin/i end |
#firefox_path ⇒ Object
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 |
#home ⇒ Object
Folder path
13 14 15 |
# File 'lib/hold_firefox.rb', line 13 def home Pathname.new(File.dirname(__FILE__)).join('..', 'ext', 'hold_firefox') end |