Sha256: c8418de154f67fda0321744b75afa093f3b3fe6689bf3375c276a4892fbdd5db

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require "shell2html"

module Shellplay
  class Screen

    include Shell2html

    attr_reader :stdin, :stdout, :stderr, :display, :timespent, :displaycommand, :playprompt, :clearscreen, :customprompt

    def initialize
      @displaycommand = true
      @playprompt = true
      @clearscreen = false
      @customprompt = nil
      @stdin = nil
      @stdout = nil
      @stderr = nil
      @timespent = 0
    end

    def import(hash)
      @displaycommand = !!hash['displaycommand']
      @playprompt = !!hash['playprompt']
      @clearscreen = !!hash['clearscreen']
      @customprompt = hash['customprompt']
      @stdin = hash['stdin']
      @stdout = hash['stdout']
      @stderr = hash['stderr']
      @timespent = hash['timespent']
    end

    def export
      {
        displaycommand: @displaycommand,
        playprompt: @playprompt,
        clearscreen: @clearscreen,
        customprompt: @customprompt,
        stdin: @stdin,
        stdout: @stdout,
        stderr: @stderr,
        timespent: @timespent
      }
    end

    def html
      to_html(@stdout)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shellplay-0.1.2 lib/shellplay/screen.rb