Class: Firebrew::Firefox::Command
- Inherits:
-
Object
- Object
- Firebrew::Firefox::Command
- Defined in:
- lib/firebrew/firefox/command.rb
Defined Under Namespace
Classes: Executer
Instance Method Summary collapse
-
#initialize(config = {}, executer = Executer.new) ⇒ Command
constructor
A new instance of Command.
- #version ⇒ Object
Constructor Details
#initialize(config = {}, executer = Executer.new) ⇒ Command
Returns a new instance of Command.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/firebrew/firefox/command.rb', line 9 def initialize(config={}, executer = Executer.new) @config = config @executer = executer begin result = @executer.exec('"%{firefox}" --version' % @config) raise Firebrew::FirefoxCommandError unless result[0] =~ /Mozilla Firefox/ raise Firebrew::FirefoxCommandError unless result[1] == 0 rescue SystemCallError raise Firebrew::FirefoxCommandError end end |
Instance Method Details
#version ⇒ Object
21 22 23 24 25 |
# File 'lib/firebrew/firefox/command.rb', line 21 def version return @version if @version.present? result = @executer.exec('"%{firefox}" --version' % @config)[0] @version = result.match(/[0-9.]+/)[0] end |