Skip to content

Commit

Permalink
Add Ferrum::Brower::Base.version method
Browse files Browse the repository at this point in the history
It returns the actual executable's version such as `Chromium 129.0.6668.89 built on Ubuntu 24.04.1 LTS`
  • Loading branch information
dmexe authored Dec 2, 2024
1 parent b9cd95a commit b2fb826
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/ferrum/browser/options/base.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "singleton"
require "open3"

module Ferrum
class Browser
Expand All @@ -12,6 +13,14 @@ def self.options
instance
end

# @return [String, nil]
def self.version
out, _ = Open3.capture2(detect_path, "--version")
out.strip
rescue Errno::ENOENT
nil
end

def to_h
self.class::DEFAULT_OPTIONS
end
Expand Down

0 comments on commit b2fb826

Please sign in to comment.