Sha256: 9be7a260733ed2cfc0657a02d5f1b5dccff0d3a81e7c0b9fd8fd08cf529c9c7f

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

# Utility methods for interacting with the underlying OS
module Dynosaur
  module Utils
    module OS
      class << self
        # @return [Array] Object instances, which respond to #command, for all
        #   locally running processes returned by the ps command
        def structured_ps
          ps_array = command_ps.split("\n").map(&:strip)
          ps_array.shift # Remove the header row
          ps_array.map do |command|
            Struct.new(:command).new(command)
          end
        end

        private

        def command_ps
          `ps -o command`
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dynosaur-0.2.0 lib/dynosaur/utils/os.rb