Class AutomateIt::ShellManager::WhichBase
In: lib/automateit/shell_manager/which_base.rb
Parent: AutomateIt::ShellManager::BaseDriver

ShellManager::WhichBase

Provides abstract helper methods for other drivers implementing the which.

Methods

Public Instance methods

See ShellManager#which!

[Source]

# File lib/automateit/shell_manager/which_base.rb, line 13
  def which!(command)
    result = which(command)
    if result.nil?
      raise ArgumentError.new("command not found: #{command}")
    else
      true
    end
  end

Protected Instance methods

[Source]

# File lib/automateit/shell_manager/which_base.rb, line 24
  def _which_helper(&block)
    data = block.call
    data.strip! if data
    return (! data.blank? && File.exists?(data)) ? data : nil
  end

[Validate]