Module: Vedeu

Extended by:
Forwardable, Vedeu, API
Included in:
Vedeu
Defined in:
lib/vedeu.rb,
lib/vedeu/api.rb,
lib/vedeu/debug.rb,
lib/vedeu/traps.rb,
lib/vedeu/dsl/all.rb,
lib/vedeu/bindings.rb,
lib/vedeu/dsl/line.rb,
lib/vedeu/dsl/view.rb,
lib/vedeu/launcher.rb,
lib/vedeu/null/all.rb,
lib/vedeu/dsl/group.rb,
lib/vedeu/input/all.rb,
lib/vedeu/input/key.rb,
lib/vedeu/main_loop.rb,
lib/vedeu/dsl/stream.rb,
lib/vedeu/output/esc.rb,
lib/vedeu/application.rb,
lib/vedeu/cursor/move.rb,
lib/vedeu/input/input.rb,
lib/vedeu/models/cell.rb,
lib/vedeu/models/char.rb,
lib/vedeu/models/line.rb,
lib/vedeu/models/menu.rb,
lib/vedeu/null/border.rb,
lib/vedeu/null/buffer.rb,
lib/vedeu/output/text.rb,
lib/vedeu/support/log.rb,
lib/vedeu/events/event.rb,
lib/vedeu/input/keymap.rb,
lib/vedeu/input/mapper.rb,
lib/vedeu/models/focus.rb,
lib/vedeu/models/group.rb,
lib/vedeu/null/generic.rb,
lib/vedeu/output/clear.rb,
lib/vedeu/output/style.rb,
lib/vedeu/cursor/cursor.rb,
lib/vedeu/dsl/interface.rb,
lib/vedeu/geometry/area.rb,
lib/vedeu/geometry/grid.rb,
lib/vedeu/models/stream.rb,
lib/vedeu/null/geometry.rb,
lib/vedeu/output/border.rb,
lib/vedeu/output/colour.rb,
lib/vedeu/output/output.rb,
lib/vedeu/storage/store.rb,
lib/vedeu/support/timer.rb,
lib/vedeu/support/trace.rb,
lib/vedeu/buffers/buffer.rb,
lib/vedeu/dsl/shared/use.rb,
lib/vedeu/events/trigger.rb,
lib/vedeu/null/interface.rb,
lib/vedeu/output/refresh.rb,
lib/vedeu/support/common.rb,
lib/vedeu/distributed/all.rb,
lib/vedeu/distributed/uri.rb,
lib/vedeu/dsl/composition.rb,
lib/vedeu/dsl/shared/text.rb,
lib/vedeu/geometry/canvas.rb,
lib/vedeu/output/viewport.rb,
lib/vedeu/output/wordwrap.rb,
lib/vedeu/support/options.rb,
lib/vedeu/models/interface.rb,
lib/vedeu/output/html_char.rb,
lib/vedeu/repositories/all.rb,
lib/vedeu/support/template.rb,
lib/vedeu/support/terminal.rb,
lib/vedeu/configuration/api.rb,
lib/vedeu/configuration/cli.rb,
lib/vedeu/geometry/geometry.rb,
lib/vedeu/geometry/position.rb,
lib/vedeu/output/background.rb,
lib/vedeu/output/compressor.rb,
lib/vedeu/output/foreground.rb,
lib/vedeu/output/translator.rb,
lib/vedeu/distributed/client.rb,
lib/vedeu/distributed/server.rb,
lib/vedeu/geometry/dimension.rb,
lib/vedeu/models/composition.rb,
lib/vedeu/repositories/model.rb,
lib/vedeu/storage/fifo_store.rb,
lib/vedeu/support/visibility.rb,
lib/vedeu/dsl/components/menu.rb,
lib/vedeu/geometry/coordinate.rb,
lib/vedeu/output/presentation.rb,
lib/vedeu/output/renderers/all.rb,
lib/vedeu/cursor/refresh_cursor.rb,
lib/vedeu/dsl/components/border.rb,
lib/vedeu/dsl/components/keymap.rb,
lib/vedeu/output/renderers/file.rb,
lib/vedeu/output/renderers/html.rb,
lib/vedeu/output/renderers/json.rb,
lib/vedeu/output/renderers/null.rb,
lib/vedeu/output/renderers/text.rb,
lib/vedeu/output/virtual_buffer.rb,
lib/vedeu/buffers/display_buffer.rb,
lib/vedeu/distributed/subprocess.rb,
lib/vedeu/storage/conveyor_store.rb,
lib/vedeu/dsl/components/geometry.rb,
lib/vedeu/dsl/shared/presentation.rb,
lib/vedeu/geometry/index_position.rb,
lib/vedeu/geometry/position_index.rb,
lib/vedeu/output/virtual_terminal.rb,
lib/vedeu/repositories/collection.rb,
lib/vedeu/repositories/repository.rb,
lib/vedeu/output/renderers/terminal.rb,
lib/vedeu/repositories/registerable.rb,
lib/vedeu/storage/associative_store.rb,
lib/vedeu/configuration/configuration.rb,
lib/vedeu/geometry/position_validator.rb,
lib/vedeu/distributed/test_application.rb,
lib/vedeu/repositories/collections/keys.rb,
lib/vedeu/repositories/collections/chars.rb,
lib/vedeu/repositories/collections/lines.rb,
lib/vedeu/repositories/collections/events.rb,
lib/vedeu/repositories/repositories/menus.rb,
lib/vedeu/output/renderers/escape_sequence.rb,
lib/vedeu/repositories/collections/streams.rb,
lib/vedeu/repositories/repositories/groups.rb,
lib/vedeu/repositories/repositories/borders.rb,
lib/vedeu/repositories/repositories/buffers.rb,
lib/vedeu/repositories/repositories/colours.rb,
lib/vedeu/repositories/repositories/cursors.rb,
lib/vedeu/repositories/repositories/keymaps.rb,
lib/vedeu/repositories/collections/interfaces.rb,
lib/vedeu/repositories/repositories/geometries.rb,
lib/vedeu/repositories/repositories/events_repository.rb,
lib/vedeu/repositories/repositories/background_colours.rb,
lib/vedeu/repositories/repositories/foreground_colours.rb,
lib/vedeu/repositories/repositories/interfaces_repository.rb

Overview

Vedeu is a GUI framework for terminal/console applications written in Ruby.

Defined Under Namespace

Modules: API, Bindings, Common, Config, DSL, DisplayBuffer, Distributed, Esc, Focus, Model, Null, Presentation, Refresh, Registerable, Renderers, Repositories, Store, Terminal, Traps, VirtualBuffer Classes: Application, Area, AssociativeStore, Background, BackgroundColours, Border, Borders, Buffer, Buffers, Canvas, Cell, Char, Chars, Clear, Collection, Colour, Colours, Composition, Compressor, Configuration, ConveyorStore, Coordinate, Cursor, Cursors, Dimension, Event, Events, EventsRepository, FifoStore, Foreground, ForegroundColours, Geometries, Geometry, Grid, Group, Groups, HTMLChar, IndexPosition, Input, Interface, Interfaces, InterfacesRepository, Key, Keymap, Keymaps, Keys, Launcher, Line, Lines, Log, MainLoop, Mapper, Menu, Menus, MonoLogger, Move, Options, Output, Position, PositionIndex, PositionValidator, RefreshCursor, Repository, Stream, Streams, Style, Subprocess, Template, TestApplication, Text, Timer, Trace, Translator, Trigger, Viewport, VirtualTerminal, Visibility, Wordwrap

Constant Summary collapse

EXCEPTIONS =

ModelNotFound: Raised with Vedeu attempts to access a named model that does

not exist.

InvalidSyntax: Raised when Vedeu attempts to parse a view or

{Vedeu.interface} and encounters a problem.

MissingRequired: Raised when a name is not provided for a model when

attempting to store it in a repository.

ModeSwitch: Raised intentionally when the client application wishes to

switch between cooked and raw (or vice versa) terminal modes. Vedeu is
hard-wired to use the `Escape` key to trigger this change for the time
being.

NotImplemented: Raised to remind me (or client application developers) that

the subclass implements the functionality sought.

OutOfRange: Raised when trying to access an interface column less than 1 or

greater than 12. Vedeu is hard-wired to a 12-column layout for the time
being.

VedeuInterrupt: Raised when Vedeu wishes to exit.

%w(
  ModelNotFound
  InvalidSyntax
  MissingRequired
  ModeSwitch
  NotImplemented
  OutOfRange
  VedeuInterrupt
)

Class Method Summary collapse

Instance Method Summary collapse

Methods included from API

background_colours, background_colours, bind, bind, border, border, borders, borders, buffers, buffers, canvas, canvas, configuration, configuration, configure, configure, cursor, cursor, cursors, cursors, events, events, focus, focus, focus_by_name, focus_by_name, focus_next, focus_next, focus_previous, focus_previous, focussed?, focussed?, foreground_colours, foreground_colours, geometries, geometries, geometry, geometry, group, group, groups, groups, height, height, interface, interface, interfaces, interfaces, keymap, keymap, keymaps, keymaps, keypress, keypress, log, log, menu, menu, menus, menus, renderer, renderer, renderers, renderers, renders, renders, resize, resize, trigger, trigger, unbind, unbind, views, views, width, width

Class Method Details

.debug(filename = 'profile.html') ⇒ void

This method returns an undefined value.

:nocov: Helps to debug a running application by providing a stack trace of its execution upon exiting.

Parameters:

  • filename (String) (defaults to: 'profile.html')

Yield Returns:

  • (void)

    The section of the application to debug.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/vedeu/debug.rb', line 10

def self.debug(filename = 'profile.html')
  return nil unless block_given?

  require 'ruby-prof'

  RubyProf.measure_mode = RubyProf::WALL_TIME
  # RubyProf.measure_mode = RubyProf::PROCESS_TIME
  # RubyProf.measure_mode = RubyProf::CPU_TIME
  # RubyProf.measure_mode = RubyProf::ALLOCATIONS
  # RubyProf.measure_mode = RubyProf::MEMORY
  # RubyProf.measure_mode = RubyProf::GC_TIME
  # RubyProf.measure_mode = RubyProf::GC_RUNS

  RubyProf.start

  yield

  result = RubyProf.stop
  result.eliminate_methods!([
    /^Array/,
    /^Hash/,
  ])

  File.open('/tmp/' + filename, 'w') do |file|
    RubyProf::CallStackPrinter.new(result).print(file)

    # Used with QTCacheGrind to analyse performance.
    # RubyProf::CallTreePrinter.new(result).print(file)

    # Creates a flat report in text format
    # RubyProf::FlatPrinter

    # - same as above but more verbose
    # RubyProf::FlatPrinterWithLineNumbers

    # - Creates a call graph report in text format
    # RubyProf::GraphPrinter

    # - Creates a call graph report in HTML (separate files per thread)
    # RubyProf::GraphHtmlPrinter

    # - Creates a call graph report in GraphViz's DOT format which can be
    #   converted to an image
    # RubyProf::DotPrinter

    # - Creates a call tree report compatible with KCachegrind.
    # RubyProf::CallTreePrinter

    # - Creates a HTML visualization of the Ruby stack
    # RubyProf::CallStackPrinter

    # - Uses the other printers to create several reports in one profiling run
    # RubyProf::MultiPrinter
  end
end

.focusableVedeu::Focus

Returns:



28
29
30
# File 'lib/vedeu.rb', line 28

def self.focusable
  @focusable ||= Vedeu::Focus
end

.included(receiver) ⇒ void

This method returns an undefined value.

When Vedeu is included within one of your classes, you should have all API methods at your disposal.

Examples:

class YourClassHere
  include Vedeu
  ...

Parameters:

  • receiver


42
43
44
45
# File 'lib/vedeu.rb', line 42

def included(receiver)
  receiver.send(:include, API)
  receiver.extend(API)
end

Instance Method Details

#included(receiver) ⇒ void

This method returns an undefined value.

When Vedeu is included within one of your classes, you should have all API methods at your disposal.

Examples:

class YourClassHere
  include Vedeu
  ...

Parameters:

  • receiver


42
43
44
45
# File 'lib/vedeu.rb', line 42

def included(receiver)
  receiver.send(:include, API)
  receiver.extend(API)
end