def dump(io=nil, opts=nil, &block)

      io, opts = nil, io if io.is_a?(Hash)
      opts ||= {}

      o = lambda { |k| v = opts[k] || opts["#{k}s".to_sym]; v ? Array(v) : nil }
        #
      exis = o[:exid]
      doms = o[:domain]
      sdms = o[:strict_domain] || o[:sdomain]
        #
      filter = lambda { |q|
        q = q.where(
          exid: exis) if exis
        q = q.where {
          Sequel.|(*doms
            .inject([]) { |a, d|
              a.concat([
                { domain: d },
                Sequel.like(:domain, d + '.%') ]) }) } if doms
        q = q.where(
          domain: sdms) if sdms
        q }

      exs, tms, tps, pts =
        storage.db.transaction {
          [ filter[executions].collect(&:to_h),
            filter[timers].collect(&:to_h),
            filter[traps].collect(&:to_h),
            filter[pointers].collect(&:to_h) ] }

      o = io ? io : StringIO.new

      h = {
        timestamp: Flor.tstamp,
        executions: exs,
        timers: tms,
        traps: tps,
        pointers: pts }

      block.call(h) if block

      JSON.dump(h, o)

      io ? io : o.string
    end
def dump(io=nil, opts=nil, &block)

      io, opts = nil, io if io.is_a?(Hash)
      opts ||= {}

      o = lambda { |k| v = opts[k] || opts["#{k}s".to_sym]; v ? Array(v) : nil }
        #
      exis = o[:exid]
      doms = o[:domain]
      sdms = o[:strict_domain] || o[:sdomain]
        #
      filter = lambda { |q|
        q = q.where(
          exid: exis) if exis
        q = q.where {
          Sequel.|(*doms
            .inject([]) { |a, d|
              a.concat([
                { domain: d },
                Sequel.like(:domain, d + '.%') ]) }) } if doms
        q = q.where(
          domain: sdms) if sdms
        q }

      exs, tms, tps, pts =
        storage.db.transaction {
          [ filter[executions].collect(&:to_h),
            filter[timers].collect(&:to_h),
            filter[traps].collect(&:to_h),
            filter[pointers].collect(&:to_h) ] }

      o = io ? io : StringIO.new

      h = {
        timestamp: Flor.tstamp,
        executions: exs,
        timers: tms,
        traps: tps,
        pointers: pts }

      block.call(h) if block

      JSON.dump(h, o)

      io ? io : o.string
    end
Dumps all or some of the executions to a JSON string.
 See Scheduler#load for importing.

 unit.dump -> string  # returns a JSON string of all executions
 unit.dump(io) -> io  # dumps the JSON to the given IO instance

 unit.dump(exid: i)  # dumps only the given execution
 unit.dump(exids: [ i0, i1 ])  # dumps only the givens executions
 unit.dump(domain: d)            # dumps exes from domains,
 unit.dump(domains: [ d0, d1 ])  # and their subdomains
 unit.dump(sdomain: d)            # dumps strictly from given domains,
 unit.dump(sdomains: [ d0, d1 ])  # doesn't look at subdomains

 unit.dump() { |h| ... }  # modify the has right before it's turned to JSON