Sha256: 3ed1b7249eb209e826b337ab0a56a01284136bac79ef92f304b176f47750980c
Contents?: true
Size: 820 Bytes
Versions: 13
Compression:
Stored size: 820 Bytes
Contents
require 'json' module Norikra class Stats attr_accessor :host, :port, :ui_port, :threads, :log attr_accessor :targets, :queries def initialize(opts={}) @host = opts[:host] @port = opts[:port] @ui_port = opts[:ui_port] @threads = opts[:threads] @log = opts[:log] @targets = opts[:targets] || [] @queries = opts[:queries] || [] end def to_hash {host: @host, port: @port, ui_port: @ui_port, threads: @threads, log: @log, targets: @targets, queries: @queries} end def dump(path) File.open(path, 'w') do |file| file.write(JSON.pretty_generate(self.to_hash)) end end def self.load(path) File.open(path, 'r') do |file| self.new(JSON.parse(file.read, symbolize_names: true)) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems