Module: FeedImport
- Defined in:
- lib/rbkb/plug/feed_import.rb
Class Method Summary collapse
-
.import_dump(file) ⇒ Object
Imports from hexdumps separated by “%” and merged by ‘,’.
- .import_pcap ⇒ Object
-
.import_rawfiles(glob_pat) ⇒ Object
Imports raw messages in files by a glob pattern (i.e. /tmp/foo/msgs.*) Manage filenames so that they’re in the right order on import.
-
.import_yaml(file) ⇒ Object
Imports an array from yaml.
Class Method Details
.import_dump(file) ⇒ Object
Imports from hexdumps separated by “%” and merged by ‘,’
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rbkb/plug/feed_import.rb', line 53 def import_dump(file) ret = [] dat = File.read(file) dat.strip.split(/^%$/).each do |msg| ret << "" msg.strip.split(/^,$/).each do |chunk| ret[-1] << chunk.strip.dehexdump end end return ret end |
.import_pcap ⇒ Object
.import_rawfiles(glob_pat) ⇒ Object
Imports raw messages in files by a glob pattern (i.e. /tmp/foo/msgs.*) Manage filenames so that they’re in the right order on import. See Dir.glob for valid globbing patterns.
69 70 71 |
# File 'lib/rbkb/plug/feed_import.rb', line 69 def import_rawfiles(glob_pat) Dir.glob(glob_pat).map { |f| File.read(f) } end |