Module Sketches::Config
In: lib/sketches/config.rb
StandardError UnknownSketch RuntimeError EditorNotDefined Tempfile TempSketch Hash Cache Sketch Config Sketches dot/f_1.png

Methods

Constants

TMPDIR = Dir.tmpdir   Directory to store temporary sketches in
EDITOR = ENV['EDITOR']   Default editor to use
PAUSE = 3   Default pause between checking if sketches were modified

Public Class methods

Returns true if the editor shall be ran as a background or a foreground process, returns false otherwise.

  Config.background
  # => false

[Source]

# File lib/sketches/config.rb, line 68
    def Config.background
      @@sketches_background
    end

Sets the background mode to the specified mode.

  Config.background = true

[Source]

# File lib/sketches/config.rb, line 77
    def Config.background=(mode)
      @@sketches_background = mode
    end

Returns the current editor to use for editing sketches.

  Config.editor
  # => 'pico'

[Source]

# File lib/sketches/config.rb, line 132
    def Config.editor
      @@sketches_editor
    end

Use the specified new_editor to edit sketches. new_editor may be either a String or a lambda which accepts the path of the sketch and returns the command to run.

  Config.editor = 'gvim'

  Config.editor = lambda { |path|
    "xterm -fg gray -bg black -e vim #{path} &"
  }

[Source]

# File lib/sketches/config.rb, line 147
    def Config.editor=(new_editor)
      @@sketches_editor = new_editor
    end

Returns true if the sketch is eval‘d immediatly on editor quit (only if background = false)

  Config.eval_after_editor_quit
  # => false

[Source]

# File lib/sketches/config.rb, line 88
    def Config.eval_after_editor_quit
      @@sketches_eval_after_editor_quit
    end

When background is false, can eval immediately after editor quits.

  Config.eval_after_editor_quit = true

[Source]

# File lib/sketches/config.rb, line 97
    def Config.eval_after_editor_quit=(mode)
      @@sketches_eval_after_editor_quit = mode
    end

Returns the current number of seconds to pause in between checking if any sketches were modified.

  Config.pause
  # => 3

[Source]

# File lib/sketches/config.rb, line 158
    def Config.pause
      @@sketches_pause
    end

Use the specified number of seconds to pause in between checking if any sketches were modified.

  Config.pause = 2

[Source]

# File lib/sketches/config.rb, line 168
    def Config.pause=(seconds)
      @@sketches_pause = seconds
    end

Returns the terminal to optionally run the editor within.

  Config.terminal
  # => "xterm"

[Source]

# File lib/sketches/config.rb, line 107
    def Config.terminal
      @@sketches_terminal
    end

Sets the terminal to optionally run the editor within to the specified new_term. new_term may either be a String or a Proc.

  Config.terminal = 'gnome-terminal'

  Config.terminal = lambda { |cmd|
    "xterm -fg gray -bg black -e #{cmd.dump} &"
  }

[Source]

# File lib/sketches/config.rb, line 122
    def Config.terminal=(new_term)
      @@sketches_terminal = new_term
    end

Returns the directory to store temporary sketches in.

  Config.tmpdir
  # => "/tmp"

[Source]

# File lib/sketches/config.rb, line 49
    def Config.tmpdir
      @@sketches_tmpdir
    end

Sets the directory to store temporary sketches in to the specified directory.

[Source]

# File lib/sketches/config.rb, line 57
    def Config.tmpdir=(directory)
      @@sketches_tmpdir = File.expand_path(directory)
    end

[Validate]