Class: Guard::Jobs::TerminalSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/jobs/pry_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initializeTerminalSettings

Returns a new instance of TerminalSettings


15
16
17
18
# File 'lib/guard/jobs/pry_wrapper.rb', line 15

def initialize
  @settings = nil
  @works = Shellany::Sheller.run("hash", "stty") || false
end

Instance Method Details

#configurable?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'lib/guard/jobs/pry_wrapper.rb', line 35

def configurable?
  @works
end

#echoObject


30
31
32
33
# File 'lib/guard/jobs/pry_wrapper.rb', line 30

def echo
  return unless configurable?
  Shellany::Sheller.run("stty echo 2>#{IO::NULL}")
end

#restoreObject


20
21
22
23
# File 'lib/guard/jobs/pry_wrapper.rb', line 20

def restore
  return unless configurable? && @settings
  Shellany::Sheller.run("stty #{ @setting } 2>#{IO::NULL}")
end

#saveObject


25
26
27
28
# File 'lib/guard/jobs/pry_wrapper.rb', line 25

def save
  return unless configurable?
  @settings = Shellany::Sheller.stdout("stty -g 2>#{IO::NULL}").chomp
end