Class: Reservoir::WhichScript

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ WhichScript

Returns a new instance of WhichScript.



7
8
9
10
# File 'lib/reservoir/which_script.rb', line 7

def initialize(data = {})
  @caller = Caller.new(:remote_server => data[:remote_server], :remote_user => data[:remote_user])
  @success = false
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/reservoir/which_script.rb', line 5

def path
  @path
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/reservoir/which_script.rb', line 5

def response
  @response
end

#scriptObject

Returns the value of attribute script.



5
6
7
# File 'lib/reservoir/which_script.rb', line 5

def script
  @script
end

Instance Method Details

#go(app_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/reservoir/which_script.rb', line 20

def go(app_name)
  @script = app_name
  @path = @caller.go_with_response("which #{app_name}")
  
  if @path == ''
    @path = nil
    @success = false
    @response = 'script not installed'
  else
    @success = true
    @response = @path
  end
  @success
end

#remote_serverObject



16
17
18
# File 'lib/reservoir/which_script.rb', line 16

def remote_server
  @caller.remote_server
end

#remote_userObject



12
13
14
# File 'lib/reservoir/which_script.rb', line 12

def remote_user
  @caller.remote_user
end

#success?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/reservoir/which_script.rb', line 35

def success?
  @success
end