lib/hawatel_ps/windows/proc_table.rb
def search_by_name(process_name)
          if process_name =~ /^\/.*\/$/
            process_name.slice!(0)
            process_name = Regexp.new(/#{process_name.chop}/)
            find_all
          else
            find_by_name(process_name)
          end

          process_list = Array.new

          @proc_table.each do |process|
            if process_name.is_a? Regexp
              process_list << process if process.name =~ process_name || process.commandline =~ process_name
            else
              process_list << process if process.name.to_s.downcase == "#{process_name.to_s.downcase}" || process.commandline.to_s.downcase == "#{process_name.to_s.downcase}"
            end
          end

          process_list = nil if process_list.empty?

          return process_list
        end
# Return attributes of searched process based on name or cmdline
# @example
#   search_by_name('java.exe')
#   search_by_name('/^regex/')
# @param process_name[String] name of process
# @return [Array<ProcInfo>]
Return attributes of searched process based on name or cmdline
Return attributes of searched process based on name or cmdline
def search_by_name(process_name)
          if process_name =~ /^\/.*\/$/
            process_name.slice!(0)
            process_name = Regexp.new(/#{process_name.chop}/)
            find_all
          else
            find_by_name(process_name)
          end
          process_list = Array.new
          @proc_table.each do |process|
            if process_name.is_a? Regexp
              process_list << process if process.name =~ process_name || process.commandline =~ process_name
            else
              process_list << process if process.name.to_s.downcase == "#{process_name.to_s.downcase}" || process.commandline.to_s.downcase == "#{process_name.to_s.downcase}"
            end
          end
          process_list = nil if process_list.empty?
          return process_list
        end
def search_by_name ( process_name ) if process_name =~ / ^ \/ .* \/ $ / process_name . slice! ( 0 ) process_name = Regexp . new ( / #{ process_name . chop } / ) find_all else find_by_name ( process_name ) end process_list = Array . new @proc_table . each do | process | if process_name . is_a? Regexp process_list << process if process . name =~ process_name || process . commandline =~ process_name else process_list << process if process . name . to_s . downcase == "#{process_name.to_s.downcase}" || process . commandline . to_s . downcase == "#{process_name.to_s.downcase}" end end process_list = nil if process_list . empty? return process_list end
Return attributes of searched process based on name or cmdline
Return attributes of searched process based on name or cmdline
None
Array<ProcInfo>
process_name
name of process
name of process
example
None