Sha256: 6a120bf1b9ec28559dc94f8fb7a08c41fa13a261112bed66e5a2e835ce01eb79

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

# class for the screen object
module Shellplay
  class Screen

    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

    # transforms a hash into a screen object
    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

    # transfroms a screen object into a hash
    def export
      {
        displaycommand: @displaycommand,
        playprompt: @playprompt,
        clearscreen: @clearscreen,
        customprompt: @customprompt,
        stdin: @stdin,
        stdout: @stdout,
        stderr: @stderr,
        timespent: @timespent
      }
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shellplay-0.1.9 lib/shellplay/screen.rb
shellplay-0.1.8 lib/shellplay/screen.rb
shellplay-0.1.7 lib/shellplay/screen.rb