Class: Shellplay::Screen

Inherits:
Object
  • Object
show all
Defined in:
lib/shellplay/screen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScreen

Returns a new instance of Screen.



7
8
9
10
11
12
13
14
15
16
# File 'lib/shellplay/screen.rb', line 7

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

Instance Attribute Details

#clearscreenObject (readonly)

Returns the value of attribute clearscreen.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def clearscreen
  @clearscreen
end

#custompromptObject (readonly)

Returns the value of attribute customprompt.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def customprompt
  @customprompt
end

#displayObject (readonly)

Returns the value of attribute display.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def display
  @display
end

#displaycommandObject (readonly)

Returns the value of attribute displaycommand.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def displaycommand
  @displaycommand
end

#playpromptObject (readonly)

Returns the value of attribute playprompt.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def playprompt
  @playprompt
end

#stderrObject (readonly)

Returns the value of attribute stderr.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def stderr
  @stderr
end

#stdinObject (readonly)

Returns the value of attribute stdin.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def stdin
  @stdin
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def stdout
  @stdout
end

#timespentObject (readonly)

Returns the value of attribute timespent.



5
6
7
# File 'lib/shellplay/screen.rb', line 5

def timespent
  @timespent
end

Instance Method Details

#exportObject

transfroms a screen object into a hash



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/shellplay/screen.rb', line 31

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

#import(hash) ⇒ Object

transforms a hash into a screen object



19
20
21
22
23
24
25
26
27
28
# File 'lib/shellplay/screen.rb', line 19

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