Forked from rebeccaskinner/gist:d7268f23b7c848365f91
Last active
August 29, 2015 14:05
-
-
Save tpendragon/75ec03ddf10542d8e463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DynamicNetworkGraph | |
class NetworkFlow | |
def self.fields | |
%w{srcAddr dstAddr srcPort dstPort protocol start end packets transferred status} | |
end | |
fields.each do |field| | |
attr_accessor field | |
end | |
def fromFields(sep, line) | |
line.split(sep).each_with_index do |value, index| | |
send(:"#{self.class.fields[index]}=", value) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment