Module: Sketches::Config
- Defined in:
- lib/sketches/config.rb
Constant Summary collapse
- TMPDIR =
Directory to store temporary sketches in
Dir.tmpdir
- EDITOR =
Default editor to use
ENV['EDITOR']
- PAUSE =
Default pause between checking if sketches were modified
3
- @@sketches_tmpdir =
TMPDIR
- @@sketches_background =
false
- @@sketches_eval_after_editor_quit =
false
- @@sketches_terminal =
nil
- @@sketches_editor =
EDITOR
- @@sketches_pause =
PAUSE
Class Method Summary collapse
-
.background ⇒ Object
Returns
true
if the editor shall be ran as a background or a foreground process, returnsfalse
otherwise. -
.background=(mode) ⇒ Object
Sets the background mode to the specified mode.
-
.editor ⇒ Object
Returns the current editor to use for editing sketches.
-
.editor=(new_editor) ⇒ Object
Use the specified new_editor to edit sketches.
-
.eval_after_editor_quit ⇒ Object
Returns
true
if the sketch is eval’d immediatly on editor quit (only if background = false). -
.eval_after_editor_quit=(mode) ⇒ Object
When background is false, can eval immediately after editor quits.
-
.pause ⇒ Object
Returns the current number of seconds to pause in between checking if any sketches were modified.
-
.pause=(seconds) ⇒ Object
Use the specified number of seconds to pause in between checking if any sketches were modified.
-
.terminal ⇒ Object
Returns the terminal to optionally run the editor within.
-
.terminal=(new_term) ⇒ Object
Sets the terminal to optionally run the editor within to the specified new_term.
-
.tmpdir ⇒ Object
Returns the directory to store temporary sketches in.
-
.tmpdir=(directory) ⇒ Object
Sets the directory to store temporary sketches in to the specified directory.
Class Method Details
.background ⇒ Object
Returns true
if the editor shall be ran as a background or a foreground process, returns false
otherwise.
Config.background
# => false
68 69 70 |
# File 'lib/sketches/config.rb', line 68 def Config.background @@sketches_background end |
.background=(mode) ⇒ Object
Sets the background mode to the specified mode.
Config.background = true
77 78 79 |
# File 'lib/sketches/config.rb', line 77 def Config.background=(mode) @@sketches_background = mode end |
.editor ⇒ Object
Returns the current editor to use for editing sketches.
Config.editor
# => 'pico'
132 133 134 |
# File 'lib/sketches/config.rb', line 132 def Config.editor @@sketches_editor end |
.editor=(new_editor) ⇒ Object
147 148 149 |
# File 'lib/sketches/config.rb', line 147 def Config.editor=(new_editor) @@sketches_editor = new_editor end |
.eval_after_editor_quit ⇒ Object
Returns true
if the sketch is eval’d immediatly on editor quit (only if background = false)
Config.eval_after_editor_quit
# => false
88 89 90 |
# File 'lib/sketches/config.rb', line 88 def Config.eval_after_editor_quit @@sketches_eval_after_editor_quit end |
.eval_after_editor_quit=(mode) ⇒ Object
When background is false, can eval immediately after editor quits.
Config.eval_after_editor_quit = true
97 98 99 |
# File 'lib/sketches/config.rb', line 97 def Config.eval_after_editor_quit=(mode) @@sketches_eval_after_editor_quit = mode end |
.pause ⇒ Object
Returns the current number of seconds to pause in between checking if any sketches were modified.
Config.pause
# => 3
158 159 160 |
# File 'lib/sketches/config.rb', line 158 def Config.pause @@sketches_pause end |
.pause=(seconds) ⇒ Object
168 169 170 |
# File 'lib/sketches/config.rb', line 168 def Config.pause=(seconds) @@sketches_pause = seconds end |
.terminal ⇒ Object
Returns the terminal to optionally run the editor within.
Config.terminal
# => "xterm"
107 108 109 |
# File 'lib/sketches/config.rb', line 107 def Config.terminal @@sketches_terminal end |
.terminal=(new_term) ⇒ Object
122 123 124 |
# File 'lib/sketches/config.rb', line 122 def Config.terminal=(new_term) @@sketches_terminal = new_term end |
.tmpdir ⇒ Object
Returns the directory to store temporary sketches in.
Config.tmpdir
# => "/tmp"
49 50 51 |
# File 'lib/sketches/config.rb', line 49 def Config.tmpdir @@sketches_tmpdir end |
.tmpdir=(directory) ⇒ Object
Sets the directory to store temporary sketches in to the specified directory.
57 58 59 |
# File 'lib/sketches/config.rb', line 57 def Config.tmpdir=(directory) @@sketches_tmpdir = File.(directory) end |