Module: Vedeu::Terminal::Mode
Overview
Store the current mode of the terminal.
Class Method Summary collapse
-
.cooked_mode! ⇒ Symbol
Sets the terminal in to ‘cooked` mode.
-
.cooked_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘cooked` mode.
-
.fake_mode! ⇒ Symbol
Sets the terminal in to ‘fake` mode.
-
.fake_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘fake` mode.
-
.mode ⇒ Symbol
Returns the mode of the terminal, either ‘:cooked`, `:fake` or `:raw`.
-
.raw_mode! ⇒ Symbol
Sets the terminal in to ‘raw` mode.
-
.raw_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘raw` mode.
-
.switch_mode! ⇒ Symbol
Toggles the terminal’s mode between ‘cooked`, `fake` and `raw`, depending on its current mode.
Instance Method Summary collapse
-
#cooked_mode! ⇒ Symbol
Sets the terminal in to ‘cooked` mode.
-
#cooked_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘cooked` mode.
-
#fake_mode! ⇒ Symbol
Sets the terminal in to ‘fake` mode.
-
#fake_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘fake` mode.
-
#mode ⇒ Symbol
Returns the mode of the terminal, either ‘:cooked`, `:fake` or `:raw`.
-
#raw_mode! ⇒ Symbol
Sets the terminal in to ‘raw` mode.
-
#raw_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘raw` mode.
-
#switch_mode! ⇒ Symbol
Toggles the terminal’s mode between ‘cooked`, `fake` and `raw`, depending on its current mode.
Class Method Details
.cooked_mode! ⇒ Symbol
Sets the terminal in to ‘cooked` mode.
22 23 24 |
# File 'lib/vedeu/terminal/mode.rb', line 22 def cooked_mode! @mode = :cooked end |
.cooked_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘cooked` mode.
15 16 17 |
# File 'lib/vedeu/terminal/mode.rb', line 15 def cooked_mode? mode == :cooked end |
.fake_mode! ⇒ Symbol
Sets the terminal in to ‘fake` mode.
37 38 39 |
# File 'lib/vedeu/terminal/mode.rb', line 37 def fake_mode! @mode = :fake end |
.fake_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘fake` mode.
30 31 32 |
# File 'lib/vedeu/terminal/mode.rb', line 30 def fake_mode? mode == :fake end |
.mode ⇒ Symbol
Returns the mode of the terminal, either ‘:cooked`, `:fake` or `:raw`. Can change throughout the lifespan of the client application.
72 73 74 |
# File 'lib/vedeu/terminal/mode.rb', line 72 def mode @mode ||= Vedeu::Configuration.terminal_mode end |
.raw_mode! ⇒ Symbol
Sets the terminal in to ‘raw` mode.
52 53 54 |
# File 'lib/vedeu/terminal/mode.rb', line 52 def raw_mode! @mode = :raw end |
.raw_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘raw` mode.
45 46 47 |
# File 'lib/vedeu/terminal/mode.rb', line 45 def raw_mode? mode == :raw end |
.switch_mode! ⇒ Symbol
Toggles the terminal’s mode between ‘cooked`, `fake` and `raw`, depending on its current mode.
60 61 62 63 64 65 |
# File 'lib/vedeu/terminal/mode.rb', line 60 def switch_mode! return fake_mode! if raw_mode? return cooked_mode! if fake_mode? raw_mode! end |
Instance Method Details
#cooked_mode! ⇒ Symbol
Sets the terminal in to ‘cooked` mode.
22 23 24 |
# File 'lib/vedeu/terminal/mode.rb', line 22 def cooked_mode! @mode = :cooked end |
#cooked_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘cooked` mode.
15 16 17 |
# File 'lib/vedeu/terminal/mode.rb', line 15 def cooked_mode? mode == :cooked end |
#fake_mode! ⇒ Symbol
Sets the terminal in to ‘fake` mode.
37 38 39 |
# File 'lib/vedeu/terminal/mode.rb', line 37 def fake_mode! @mode = :fake end |
#fake_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘fake` mode.
30 31 32 |
# File 'lib/vedeu/terminal/mode.rb', line 30 def fake_mode? mode == :fake end |
#mode ⇒ Symbol
Returns the mode of the terminal, either ‘:cooked`, `:fake` or `:raw`. Can change throughout the lifespan of the client application.
72 73 74 |
# File 'lib/vedeu/terminal/mode.rb', line 72 def mode @mode ||= Vedeu::Configuration.terminal_mode end |
#raw_mode! ⇒ Symbol
Sets the terminal in to ‘raw` mode.
52 53 54 |
# File 'lib/vedeu/terminal/mode.rb', line 52 def raw_mode! @mode = :raw end |
#raw_mode? ⇒ Boolean
Returns a boolean indicating whether the terminal is currently in ‘raw` mode.
45 46 47 |
# File 'lib/vedeu/terminal/mode.rb', line 45 def raw_mode? mode == :raw end |
#switch_mode! ⇒ Symbol
Toggles the terminal’s mode between ‘cooked`, `fake` and `raw`, depending on its current mode.
60 61 62 63 64 65 |
# File 'lib/vedeu/terminal/mode.rb', line 60 def switch_mode! return fake_mode! if raw_mode? return cooked_mode! if fake_mode? raw_mode! end |