lib/hawatel_ps/windows/proc_table.rb
def search_by_condition(args)
          find_all

          attrs = args[:attr]
          oper  = args[:oper]
          value = args[:value]
          process_list = Array.new
          @proc_table.each do |process|
            if oper == '>'
              process_list << process if process[:"#{attrs}"] > value
            elsif oper == '<'
              process_list << process if process[:"#{attrs}"] < value
            elsif oper == '>='
              process_list << process if process[:"#{attrs}"] >= value
            elsif oper == '<='
              process_list << process if process[:"#{attrs}"] <= value
            elsif oper == '=='
              process_list << process if process[:"#{attrs}"] == value
            elsif oper == '!='
              process_list << process if process[:"#{attrs}"] != value
            end
          end

          process_list = nil if process_list.empty?

          return process_list
        end
# Return attributes of searched by process
#
# @example
#   search_by_condition(:attrs => 'workingsetsize', :oper => '<', value => '10000')
#
# @param args[Hash] attributes for search condition
#   @attrs [String], name of process attribute (first expression for if)
#   @oper  [String], operatator, available options: >,<,>=,<=,==,!=
#   @value [String], value comparable (second expression for if)
#
# @return [Array<ProcInfo>]
Return attributes of searched by process
Return attributes of searched by process
def search_by_condition(args)
          find_all
          attrs = args[:attr]
          oper  = args[:oper]
          value = args[:value]
          process_list = Array.new
          @proc_table.each do |process|
            if oper == '>'
              process_list << process if process[:"#{attrs}"] > value
            elsif oper == '<'
              process_list << process if process[:"#{attrs}"] < value
            elsif oper == '>='
              process_list << process if process[:"#{attrs}"] >= value
            elsif oper == '<='
              process_list << process if process[:"#{attrs}"] <= value
            elsif oper == '=='
              process_list << process if process[:"#{attrs}"] == value
            elsif oper == '!='
              process_list << process if process[:"#{attrs}"] != value
            end
          end
          process_list = nil if process_list.empty?
          return process_list
        end
def search_by_condition ( args ) find_all attrs = args [ :attr ] oper = args [ :oper ] value = args [ :value ] process_list = Array . new @proc_table . each do | process | if oper == '>' process_list << process if process [ :" #{ attrs } " ] > value elsif oper == '<' process_list << process if process [ :" #{ attrs } " ] < value elsif oper == '>=' process_list << process if process [ :" #{ attrs } " ] >= value elsif oper == '<=' process_list << process if process [ :" #{ attrs } " ] <= value elsif oper == '==' process_list << process if process [ :" #{ attrs } " ] == value elsif oper == '!=' process_list << process if process [ :" #{ attrs } " ] != value end end process_list = nil if process_list . empty? return process_list end
Return attributes of searched by process
Return attributes of searched by process
None
Array<ProcInfo>
args
attributes for search condition @attrs [String], name of process attribute (first expression for if) @oper [String], operatator, available options: >,<,>=,<=,==,. @value [String], value comparable (second expression for if)
attributes for search condition @attrs [ String ] name of process attribute ( first expression for if ) @oper [ String ] operatator available options : > < > = < = == . @value [ String ] value comparable ( second expression for if )
example
None