Sha256: cde59016664f1bc57f43ff9556dd828bf645f26998ac00bbcac5abbf5145e9cb

Contents?: true

Size: 1.16 KB

Versions: 32

Compression:

Stored size: 1.16 KB

Contents

module Cuboid
class Data

# Data for {Cuboid::Application}.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
class Application

    # {Application} error namespace.
    #
    # All {Application} errors inherit from and live under it.
    #
    # @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
    class Error < Data::Error
    end

    attr_accessor :runtime
    attr_accessor :report

    def statistics
        {
          runtime: !!@runtime,
          report:  !!@report
        }
    end

    def dump( directory )
        FileUtils.mkdir_p( directory )

        d = Cuboid::Application.serializer.dump( @report )
        IO.binwrite( "#{directory}/report", d )

        d = Cuboid::Application.serializer.dump( @runtime )
        IO.binwrite( "#{directory}/runtime", d )
    end

    def self.load( directory )
        application = new
        application.report  = Cuboid::Application.serializer.load( IO.binread( "#{directory}/report" ) )
        application.runtime = Cuboid::Application.serializer.load( IO.binread( "#{directory}/runtime" ) )
        application
    end

    def clear
        @runtime = nil
        @report  = nil
    end

end

end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cuboid-0.2.11 lib/cuboid/data/application.rb
cuboid-0.2.10 lib/cuboid/data/application.rb
cuboid-0.2.9 lib/cuboid/data/application.rb
cuboid-0.2.8 lib/cuboid/data/application.rb
cuboid-0.2.7 lib/cuboid/data/application.rb
cuboid-0.2.6 lib/cuboid/data/application.rb
cuboid-0.2.5 lib/cuboid/data/application.rb
cuboid-0.2.4.2 lib/cuboid/data/application.rb
cuboid-0.2.4.1 lib/cuboid/data/application.rb
cuboid-0.2.4 lib/cuboid/data/application.rb
cuboid-0.2.3 lib/cuboid/data/application.rb
cuboid-0.2.2 lib/cuboid/data/application.rb
cuboid-0.2.1 lib/cuboid/data/application.rb
cuboid-0.2 lib/cuboid/data/application.rb
cuboid-0.1.9.1 lib/cuboid/data/application.rb
cuboid-0.1.9 lib/cuboid/data/application.rb
cuboid-0.1.8 lib/cuboid/data/application.rb
cuboid-0.1.7 lib/cuboid/data/application.rb
cuboid-0.1.6.1 lib/cuboid/data/application.rb
cuboid-0.1.6 lib/cuboid/data/application.rb