Class: GetVersion::ExecutionContext

Inherits:
Object
  • Object
show all
Includes:
PlatformVersions
Defined in:
lib/getversion/execution_context.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PlatformVersions

#google_appengine_version, #osx_version, #windows_version

Constructor Details

#initialize(path) ⇒ ExecutionContext

Returns a new instance of ExecutionContext.



8
9
10
# File 'lib/getversion/execution_context.rb', line 8

def initialize(path)
  @path = path
end

Class Method Details

.execute(path, &block) ⇒ Object



16
17
18
# File 'lib/getversion/execution_context.rb', line 16

def self.execute(path, &block)
  ExecutionContext.new(path).execute(&block)
end

Instance Method Details

#execute(&block) ⇒ Object



12
13
14
# File 'lib/getversion/execution_context.rb', line 12

def execute(&block)
  instance_eval &block
end

#find_version_in_output(arg = nil) ⇒ Object



20
21
22
# File 'lib/getversion/execution_context.rb', line 20

def find_version_in_output(arg=nil)
  `"#{@path}" #{arg} 2>&1`[/(\d+\.)+\d+/]
end