Skip to content

Instantly share code, notes, and snippets.

@tpendragon
Forked from rebeccaskinner/gist:d7268f23b7c848365f91
Last active August 29, 2015 14:05
Show Gist options
  • Save tpendragon/75ec03ddf10542d8e463 to your computer and use it in GitHub Desktop.
Save tpendragon/75ec03ddf10542d8e463 to your computer and use it in GitHub Desktop.
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