vedeu 0.4.18 → 0.4.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Rakefile +1 -0
  4. data/bin/vedeu_drb_server +0 -1
  5. data/bin/vedeu_test +0 -1
  6. data/config/rubocop_enabled.yml +1 -1
  7. data/examples/borders_app.rb +0 -1
  8. data/examples/colours_app.rb +0 -1
  9. data/examples/cursor_app.rb +0 -1
  10. data/examples/drb_app.rb +0 -1
  11. data/examples/geometry_app.rb +0 -1
  12. data/examples/hello_world.rb +0 -1
  13. data/examples/lines_app.rb +0 -1
  14. data/examples/material_colours_app.rb +0 -1
  15. data/examples/typed_commands/typed_commands_app.rb +0 -1
  16. data/examples/view_templates_app/view_templates_app.rb +0 -1
  17. data/lib/vedeu/api.rb +2 -1
  18. data/lib/vedeu/application.rb +3 -2
  19. data/lib/vedeu/bindings.rb +3 -5
  20. data/lib/vedeu/buffers/buffer.rb +8 -11
  21. data/lib/vedeu/buffers/display_buffer.rb +0 -2
  22. data/lib/vedeu/configuration/api.rb +1 -4
  23. data/lib/vedeu/configuration/cli.rb +153 -74
  24. data/lib/vedeu/configuration/configuration.rb +1 -2
  25. data/lib/vedeu/cursor/cursor.rb +0 -4
  26. data/lib/vedeu/cursor/move.rb +3 -6
  27. data/lib/vedeu/cursor/refresh_cursor.rb +12 -2
  28. data/lib/vedeu/distributed/client.rb +3 -2
  29. data/lib/vedeu/distributed/server.rb +4 -3
  30. data/lib/vedeu/distributed/subprocess.rb +3 -4
  31. data/lib/vedeu/distributed/test_application.rb +0 -1
  32. data/lib/vedeu/distributed/uri.rb +0 -1
  33. data/lib/vedeu/dsl/components/border.rb +3 -4
  34. data/lib/vedeu/dsl/components/geometry.rb +1 -5
  35. data/lib/vedeu/dsl/components/keymap.rb +1 -3
  36. data/lib/vedeu/dsl/components/menu.rb +1 -2
  37. data/lib/vedeu/dsl/composition.rb +3 -4
  38. data/lib/vedeu/dsl/group.rb +1 -4
  39. data/lib/vedeu/dsl/interface.rb +3 -10
  40. data/lib/vedeu/dsl/line.rb +3 -4
  41. data/lib/vedeu/dsl/shared/text.rb +0 -3
  42. data/lib/vedeu/dsl/stream.rb +3 -4
  43. data/lib/vedeu/dsl/view.rb +0 -3
  44. data/lib/vedeu/events/event.rb +3 -3
  45. data/lib/vedeu/events/trigger.rb +3 -2
  46. data/lib/vedeu/geometry/area.rb +0 -1
  47. data/lib/vedeu/geometry/canvas.rb +0 -1
  48. data/lib/vedeu/geometry/coordinate.rb +6 -7
  49. data/lib/vedeu/geometry/dimension.rb +3 -2
  50. data/lib/vedeu/geometry/geometry.rb +0 -6
  51. data/lib/vedeu/geometry/grid.rb +3 -2
  52. data/lib/vedeu/geometry/index_position.rb +0 -1
  53. data/lib/vedeu/geometry/position.rb +0 -1
  54. data/lib/vedeu/geometry/position_index.rb +0 -1
  55. data/lib/vedeu/geometry/position_validator.rb +6 -68
  56. data/lib/vedeu/input/all.rb +0 -2
  57. data/lib/vedeu/input/input.rb +3 -2
  58. data/lib/vedeu/input/key.rb +0 -1
  59. data/lib/vedeu/input/keymap.rb +4 -7
  60. data/lib/vedeu/input/mapper.rb +3 -2
  61. data/lib/vedeu/launcher.rb +3 -2
  62. data/lib/vedeu/main_loop.rb +1 -1
  63. data/lib/vedeu/models/cell.rb +0 -1
  64. data/lib/vedeu/models/char.rb +0 -1
  65. data/lib/vedeu/models/composition.rb +1 -7
  66. data/lib/vedeu/models/group.rb +0 -3
  67. data/lib/vedeu/models/interface.rb +0 -3
  68. data/lib/vedeu/models/line.rb +0 -4
  69. data/lib/vedeu/models/menu.rb +5 -8
  70. data/lib/vedeu/models/stream.rb +0 -4
  71. data/lib/vedeu/null/all.rb +11 -0
  72. data/lib/vedeu/null/border.rb +3 -1
  73. data/lib/vedeu/null/buffer.rb +0 -1
  74. data/lib/vedeu/null/generic.rb +4 -1
  75. data/lib/vedeu/null/geometry.rb +0 -1
  76. data/lib/vedeu/null/interface.rb +36 -7
  77. data/lib/vedeu/output/background.rb +0 -1
  78. data/lib/vedeu/output/border.rb +1 -6
  79. data/lib/vedeu/output/clear.rb +3 -2
  80. data/lib/vedeu/output/colour.rb +6 -18
  81. data/lib/vedeu/output/compressor.rb +5 -2
  82. data/lib/vedeu/output/esc.rb +4 -1
  83. data/lib/vedeu/output/foreground.rb +0 -5
  84. data/lib/vedeu/output/html_char.rb +3 -2
  85. data/lib/vedeu/output/output.rb +1 -5
  86. data/lib/vedeu/output/refresh.rb +1 -1
  87. data/lib/vedeu/output/renderers/all.rb +0 -1
  88. data/lib/vedeu/output/renderers/escape_sequence.rb +3 -2
  89. data/lib/vedeu/output/renderers/file.rb +85 -80
  90. data/lib/vedeu/output/renderers/html.rb +77 -72
  91. data/lib/vedeu/output/renderers/json.rb +45 -42
  92. data/lib/vedeu/output/renderers/null.rb +11 -8
  93. data/lib/vedeu/output/renderers/terminal.rb +41 -36
  94. data/lib/vedeu/output/renderers/text.rb +41 -36
  95. data/lib/vedeu/output/style.rb +0 -3
  96. data/lib/vedeu/output/text.rb +3 -2
  97. data/lib/vedeu/output/viewport.rb +3 -2
  98. data/lib/vedeu/output/virtual_terminal.rb +0 -1
  99. data/lib/vedeu/output/wordwrap.rb +3 -2
  100. data/lib/vedeu/repositories/all.rb +7 -6
  101. data/lib/vedeu/repositories/collection.rb +0 -1
  102. data/lib/vedeu/repositories/collections/chars.rb +0 -1
  103. data/lib/vedeu/repositories/collections/events.rb +0 -1
  104. data/lib/vedeu/repositories/collections/interfaces.rb +0 -1
  105. data/lib/vedeu/repositories/collections/keys.rb +0 -1
  106. data/lib/vedeu/repositories/collections/lines.rb +0 -1
  107. data/lib/vedeu/repositories/collections/streams.rb +0 -1
  108. data/lib/vedeu/repositories/model.rb +0 -1
  109. data/lib/vedeu/repositories/registerable.rb +29 -0
  110. data/lib/vedeu/repositories/repositories/background_colours.rb +0 -1
  111. data/lib/vedeu/repositories/repositories/borders.rb +2 -13
  112. data/lib/vedeu/repositories/repositories/buffers.rb +2 -13
  113. data/lib/vedeu/repositories/repositories/colours.rb +0 -1
  114. data/lib/vedeu/repositories/repositories/cursors.rb +1 -2
  115. data/lib/vedeu/repositories/repositories/events_repository.rb +0 -1
  116. data/lib/vedeu/repositories/repositories/foreground_colours.rb +0 -1
  117. data/lib/vedeu/repositories/repositories/geometries.rb +2 -13
  118. data/lib/vedeu/repositories/repositories/groups.rb +1 -2
  119. data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -14
  120. data/lib/vedeu/repositories/repositories/keymaps.rb +1 -2
  121. data/lib/vedeu/repositories/repositories/menus.rb +1 -2
  122. data/lib/vedeu/repositories/repository.rb +14 -5
  123. data/lib/vedeu/storage/all.rb +0 -1
  124. data/lib/vedeu/storage/associative_store.rb +0 -1
  125. data/lib/vedeu/storage/conveyor_store.rb +0 -1
  126. data/lib/vedeu/storage/fifo_store.rb +0 -1
  127. data/lib/vedeu/support/log.rb +0 -3
  128. data/lib/vedeu/support/options.rb +3 -2
  129. data/lib/vedeu/support/template.rb +3 -4
  130. data/lib/vedeu/support/terminal.rb +0 -2
  131. data/lib/vedeu/support/trace.rb +6 -7
  132. data/lib/vedeu/support/visibility.rb +1 -2
  133. data/lib/vedeu.rb +3 -5
  134. data/test/lib/vedeu/buffers/buffer_test.rb +48 -13
  135. data/test/lib/vedeu/configuration/cli_test.rb +5 -4
  136. data/test/lib/vedeu/cursor/refresh_cursor_test.rb +37 -15
  137. data/test/lib/vedeu/distributed/subprocess_test.rb +1 -0
  138. data/test/lib/vedeu/dsl/shared/use_test.rb +1 -6
  139. data/test/lib/vedeu/main_loop_test.rb +11 -0
  140. data/test/lib/vedeu/null/interface_test.rb +27 -0
  141. data/test/lib/vedeu/output/output_test.rb +17 -10
  142. data/test/lib/vedeu/output/presentation_test.rb +35 -7
  143. data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +50 -0
  144. data/test/lib/vedeu/output/renderers/file_test.rb +34 -30
  145. data/test/lib/vedeu/output/renderers/html_test.rb +61 -57
  146. data/test/lib/vedeu/output/renderers/json_test.rb +40 -36
  147. data/test/lib/vedeu/output/renderers/null_test.rb +12 -8
  148. data/test/lib/vedeu/output/renderers/terminal_test.rb +17 -13
  149. data/test/lib/vedeu/output/renderers/text_test.rb +17 -13
  150. data/test/lib/vedeu/repositories/model_test.rb +1 -1
  151. data/test/lib/vedeu/repositories/registerable_test.rb +28 -0
  152. data/test/lib/vedeu/storage/associative_store_test.rb +7 -0
  153. data/test/lib/vedeu/storage/conveyor_store_test.rb +7 -0
  154. data/test/lib/vedeu/storage/fifo_store_test.rb +7 -0
  155. data/test/support/helpers/model_test_class.rb +6 -2
  156. data/test/test_helper.rb +2 -0
  157. data/vedeu.gemspec +3 -2
  158. metadata +23 -6
  159. data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +0 -46
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # When a buffer has more lines than the defined height, or more columns than
6
6
  # the defined width of the interface, the Viewport class provides 'scrolling'
7
7
  # via the cursor's position.
8
- #
9
8
  class Viewport
10
9
 
11
10
  extend Forwardable
@@ -72,12 +71,14 @@ module Vedeu
72
71
  render.map(&:to_s).join("\n")
73
72
  end
74
73
 
75
- private
74
+ protected
76
75
 
77
76
  # @!attribute [r] interface
78
77
  # @return [Vedeu::Interface]
79
78
  attr_reader :interface
80
79
 
80
+ private
81
+
81
82
  # Returns the visible content for the interface.
82
83
  #
83
84
  # @note If there are no lines of content, we return an empty array. If there
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Represents a {Vedeu::Terminal} view as a grid of {Vedeu::Cell} objects.
4
- #
5
4
  class VirtualTerminal
6
5
 
7
6
  # @!attribute [rw] renderer
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Wrap or prune text.
4
- #
5
4
  class Wordwrap
6
5
 
7
6
  # @see {Vedeu::Wordwrap#initialize}
@@ -78,7 +77,7 @@ module Vedeu
78
77
  end
79
78
  end
80
79
 
81
- private
80
+ protected
82
81
 
83
82
  # @!attribute [r] text
84
83
  # @return [String]
@@ -88,6 +87,8 @@ module Vedeu
88
87
  # @return [Hash]
89
88
  attr_reader :options
90
89
 
90
+ private
91
+
91
92
  # @param text_as_lines [Array<String>]
92
93
  # @return [Vedeu::Lines]
93
94
  def to_line_objects(text_as_lines)
@@ -1,9 +1,3 @@
1
- require_relative 'collection'
2
- require_relative 'collections/all'
3
- require_relative 'model'
4
- require_relative 'repositories/all'
5
- require_relative 'repository'
6
-
7
1
  module Vedeu
8
2
 
9
3
  # Provides all registered repositories.
@@ -39,3 +33,10 @@ module Vedeu
39
33
  end
40
34
 
41
35
  end # Vedeu
36
+
37
+ require_relative 'registerable'
38
+ require_relative 'collection'
39
+ require_relative 'collections/all'
40
+ require_relative 'model'
41
+ require_relative 'repositories/all'
42
+ require_relative 'repository'
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Convert an Array into an object which has some meaning in the context it
4
4
  # is being used.
5
- #
6
5
  class Collection
7
6
 
8
7
  include Enumerable
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # A collection of {Vedeu::Char} instances.
4
- #
5
4
  class Chars < Vedeu::Collection
6
5
 
7
6
  end # Chars
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # A collection of {Vedeu::Event} instances.
4
- #
5
4
  class Events < Vedeu::Collection
6
5
 
7
6
  end # Events
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # A collection of {Vedeu::Interface} instances.
4
- #
5
4
  class Interfaces < Vedeu::Collection
6
5
 
7
6
  end # Interfaces
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # A collection of {Vedeu::Key} instances.
4
- #
5
4
  class Keys < Vedeu::Collection
6
5
 
7
6
  end # Keys
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # A collection of {Vedeu::Line} instances.
4
- #
5
4
  class Lines < Vedeu::Collection
6
5
 
7
6
  end # Lines
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # A collection of {Vedeu::Stream} instances.
4
- #
5
4
  class Streams < Vedeu::Collection
6
5
 
7
6
  end # Streams
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # When included into a class, provides the mechanism to store the class in a
4
4
  # repository for later retrieval.
5
- #
6
5
  module Model
7
6
 
8
7
  # @!attribute [rw] repository
@@ -0,0 +1,29 @@
1
+ module Vedeu
2
+
3
+ # Repositories contain registerables, this module provides convenience methods
4
+ # for them.
5
+ module Registerable
6
+
7
+ # These class methods are mixed into the repository.
8
+ module ClassMethods
9
+
10
+ # @param klass [Class]
11
+ # @return [Symbol]
12
+ def null(klass)
13
+ define_method(:null_model) { klass }
14
+ end
15
+
16
+ end # ClassMethods
17
+
18
+ # When this module is included in a class, provide ClassMethods as class
19
+ # methods for the class.
20
+ #
21
+ # @param klass [Class]
22
+ # @return [void]
23
+ def self.included(klass)
24
+ klass.send :extend, ClassMethods
25
+ end
26
+
27
+ end # Registerable
28
+
29
+ end # Vedeu
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Store background colour escape sequences by HTML/CSS code.
4
- #
5
4
  class BackgroundColours < Colours
6
5
 
7
6
  # @return [Vedeu::BackgroundColours]
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of interface/view borders independent of the interface
4
4
  # instance.
5
- #
6
5
  class Borders < Repository
7
6
 
8
7
  class << self
@@ -17,22 +16,12 @@ module Vedeu
17
16
  #
18
17
  # @return [Vedeu::Borders]
19
18
  def reset!
20
- @borders = Vedeu::Borders.register_repository(Vedeu::Border)
19
+ @borders = Vedeu::Borders.register(Vedeu::Border)
21
20
  end
22
21
 
23
22
  end
24
23
 
25
- # @param name [String] The name of the stored border.
26
- # @return [Vedeu::Border|Vedeu::Null::Border]
27
- def by_name(name)
28
- if registered?(name)
29
- find(name)
30
-
31
- else
32
- Vedeu::Null::Border.new(name)
33
-
34
- end
35
- end
24
+ null Vedeu::Null::Border
36
25
 
37
26
  end # Borders
38
27
 
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of view buffers.
4
- #
5
4
  class Buffers < Repository
6
5
 
7
6
  class << self
@@ -16,22 +15,12 @@ module Vedeu
16
15
  #
17
16
  # @return [Vedeu::Buffers]
18
17
  def reset!
19
- @buffers = Vedeu::Buffers.register_repository(Vedeu::Buffer)
18
+ @buffers = Vedeu::Buffers.register(Vedeu::Buffer)
20
19
  end
21
20
 
22
21
  end
23
22
 
24
- # @param name [String] The name of the stored buffer.
25
- # @return [Vedeu::Buffer|Vedeu::Null::Buffer]
26
- def by_name(name)
27
- if registered?(name)
28
- find(name)
29
-
30
- else
31
- Vedeu::Null::Buffer.new(name)
32
-
33
- end
34
- end
23
+ null Vedeu::Null::Buffer
35
24
 
36
25
  end # Buffers
37
26
 
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of HTML/CSS colours and their respective escape
4
4
  # sequences.
5
- #
6
5
  class Colours
7
6
 
8
7
  # @!attribute [r] storage
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of each interface's cursor.
4
- #
5
4
  class Cursors < Repository
6
5
 
7
6
  class << self
@@ -21,7 +20,7 @@ module Vedeu
21
20
  #
22
21
  # @return [Vedeu::Cursors]
23
22
  def reset!
24
- @cursors = Vedeu::Cursors.register_repository(Vedeu::Cursor)
23
+ @cursors = Vedeu::Cursors.register(Vedeu::Cursor)
25
24
  end
26
25
 
27
26
  end
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of events.
4
- #
5
4
  class EventsRepository < Repository
6
5
 
7
6
  class << self
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Store foreground colour escape sequences by HTML/CSS code.
4
- #
5
4
  class ForegroundColours < Colours
6
5
 
7
6
  # @return [Vedeu::ForegroundColours]
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of interface/view geometry independent of the interface
4
4
  # instance.
5
- #
6
5
  class Geometries < Repository
7
6
 
8
7
  class << self
@@ -17,22 +16,12 @@ module Vedeu
17
16
  #
18
17
  # @return [Vedeu::Geometries]
19
18
  def reset!
20
- @geometries = Vedeu::Geometries.register_repository(Vedeu::Geometry)
19
+ @geometries = Vedeu::Geometries.register(Vedeu::Geometry)
21
20
  end
22
21
 
23
22
  end
24
23
 
25
- # @param name [String] The name of the stored geometry.
26
- # @return [Vedeu::Geometry|Vedeu::Null::Geometry]
27
- def by_name(name)
28
- if registered?(name)
29
- find(name)
30
-
31
- else
32
- Vedeu::Null::Geometry.new(name)
33
-
34
- end
35
- end
24
+ null Vedeu::Null::Geometry
36
25
 
37
26
  end # Geometries
38
27
 
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of view groups.
4
- #
5
4
  class Groups < Repository
6
5
 
7
6
  class << self
@@ -16,7 +15,7 @@ module Vedeu
16
15
  #
17
16
  # @return [Vedeu::Groups]
18
17
  def reset!
19
- @groups = Vedeu::Groups.register_repository(Vedeu::Group)
18
+ @groups = Vedeu::Groups.register(Vedeu::Group)
20
19
  end
21
20
 
22
21
  end
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of interfaces and views.
4
- #
5
4
  class InterfacesRepository < Repository
6
5
 
7
6
  class << self
@@ -16,23 +15,12 @@ module Vedeu
16
15
  #
17
16
  # @return [Vedeu::InterfacesRepository]
18
17
  def reset!
19
- @interfaces = Vedeu::InterfacesRepository.
20
- register_repository(Vedeu::Interface)
18
+ @interfaces = Vedeu::InterfacesRepository.register(Vedeu::Interface)
21
19
  end
22
20
 
23
21
  end
24
22
 
25
- # @param name [String]
26
- # @return [Vedeu::Interface|Vedeu::Null::Interface]
27
- def by_name(name)
28
- if registered?(name)
29
- find(name)
30
-
31
- else
32
- Vedeu::Null::Interface.new(name: name)
33
-
34
- end
35
- end
23
+ null Vedeu::Null::Interface
36
24
 
37
25
  end # InterfacesRepository
38
26
 
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of keymaps.
4
- #
5
4
  class Keymaps < Repository
6
5
 
7
6
  class << self
@@ -16,7 +15,7 @@ module Vedeu
16
15
  #
17
16
  # @return [Vedeu::Keymaps]
18
17
  def reset!
19
- @keymaps = Vedeu::Keymaps.register_repository(Vedeu::Keymap)
18
+ @keymaps = Vedeu::Keymaps.register(Vedeu::Keymap)
20
19
  end
21
20
 
22
21
  end
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of menus by name.
4
- #
5
4
  class Menus < Repository
6
5
 
7
6
  class << self
@@ -16,7 +15,7 @@ module Vedeu
16
15
  #
17
16
  # @return [Vedeu::Menus]
18
17
  def reset!
19
- @menus = Vedeu::Menus.register_repository(Vedeu::Menu)
18
+ @menus = Vedeu::Menus.register(Vedeu::Menu)
20
19
  end
21
20
 
22
21
  end
@@ -1,5 +1,3 @@
1
- require 'vedeu/models/all'
2
- require 'vedeu/storage/store'
3
1
  require 'vedeu/support/common'
4
2
 
5
3
  module Vedeu
@@ -10,10 +8,10 @@ module Vedeu
10
8
  # { 'models' => [Model, Model, Model] }
11
9
  #
12
10
  # { 'models' => [Model] }
13
- #
14
11
  class Repository
15
12
 
16
13
  include Vedeu::Common
14
+ include Vedeu::Registerable
17
15
  include Vedeu::Store
18
16
 
19
17
  # @!attribute [r] model
@@ -27,7 +25,7 @@ module Vedeu
27
25
  # @param model [Class]
28
26
  # @param storage [Class|Hash]
29
27
  # @return [Vedeu::Repository]
30
- def self.register_repository(model = nil, storage = {})
28
+ def self.register(model = nil, storage = {})
31
29
  new(model, storage).tap do |klass|
32
30
  Vedeu::Repositories.register(klass.repository)
33
31
  end
@@ -50,6 +48,18 @@ module Vedeu
50
48
  self.class # .name
51
49
  end
52
50
 
51
+ # @param name [String] The name of the stored model.
52
+ # @return [void]
53
+ def by_name(name)
54
+ if registered?(name)
55
+ find(name)
56
+
57
+ else
58
+ null_model.new(name)
59
+
60
+ end
61
+ end
62
+
53
63
  # Return the model for the interface currently in focus.
54
64
  #
55
65
  # @return [String|NilClass]
@@ -90,7 +100,6 @@ module Vedeu
90
100
  model.new(name).store
91
101
  end
92
102
  end
93
- alias_method :by_name, :find_or_create
94
103
 
95
104
  # @return [String]
96
105
  def inspect
@@ -3,4 +3,3 @@ require_relative 'store'
3
3
  require_relative 'associative_store'
4
4
  require_relative 'conveyor_store'
5
5
  require_relative 'fifo_store'
6
-
@@ -3,7 +3,6 @@ module Vedeu
3
3
  # Name/Value storage.
4
4
  #
5
5
  # name: [value]
6
- #
7
6
  class AssociativeStore
8
7
 
9
8
  include Vedeu::Store
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Conveyor belt like storage. The belt can move forward (`load_next`) or
4
4
  # backwards (`load_previous`), or a named entry can be retrieved.
5
- #
6
5
  class ConveyorStore
7
6
 
8
7
  include Vedeu::Store
@@ -3,7 +3,6 @@ module Vedeu
3
3
  # First-in first-out storage.
4
4
  #
5
5
  # in -> [3] -> [2] -> [1] -> out
6
- #
7
6
  class FifoStore
8
7
 
9
8
  include Vedeu::Store
@@ -1,9 +1,6 @@
1
- require 'vedeu/configuration/configuration'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Allows the creation of a lock-less log device.
6
- #
7
4
  class MonoLogger < Logger
8
5
 
9
6
  # Create a trappable Logger instance.
@@ -3,7 +3,6 @@ module Vedeu
3
3
  # Converts an options Hash into a class containing methods for each of the
4
4
  # keys, which when called returns the value associated. When the value is
5
5
  # either true or false, an additional predicate method is created.
6
- #
7
6
  class Options
8
7
 
9
8
  # @!attribute [r] _defined
@@ -36,12 +35,14 @@ module Vedeu
36
35
  self
37
36
  end
38
37
 
39
- private
38
+ protected
40
39
 
41
40
  # @!attribute [r] _options
42
41
  # @return [Hash]
43
42
  attr_reader :_options
44
43
 
44
+ private
45
+
45
46
  # @param alias_name [String|Symbol]
46
47
  # @param method_name [String|Symbol]
47
48
  # @return [void]
@@ -1,9 +1,6 @@
1
- require 'erb'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Generic class to loading a template and parsing it via ERb.
6
- #
7
4
  class Template
8
5
 
9
6
  # @param object [Class]
@@ -27,12 +24,14 @@ module Vedeu
27
24
  ERB.new(load, nil, '-').result(binding)
28
25
  end
29
26
 
30
- private
27
+ protected
31
28
 
32
29
  # @!attribute [r] object
33
30
  # @return [Class]
34
31
  attr_reader :object
35
32
 
33
+ private
34
+
36
35
  # @return [String]
37
36
  def load
38
37
  File.read(path)
@@ -1,6 +1,4 @@
1
1
  require 'vedeu/configuration/configuration'
2
- require 'vedeu/output/esc'
3
- require 'vedeu/support/log'
4
2
 
5
3
  module Vedeu
6
4
 
@@ -1,7 +1,3 @@
1
- require 'vedeu/configuration/configuration'
2
- require 'vedeu/output/esc'
3
- require 'vedeu/support/log'
4
-
5
1
  module Vedeu
6
2
 
7
3
  # :nocov:
@@ -9,7 +5,6 @@ module Vedeu
9
5
  # occurs inside Vedeu. This is very useful (to me!) for debugging. Running
10
6
  # this will make your application less responsive, and the tests
11
7
  # excruciatingly slow to run.
12
- #
13
8
  class Trace
14
9
 
15
10
  # @todo
@@ -48,11 +43,15 @@ module Vedeu
48
43
  # - (id) the method name being traced,
49
44
  # - (vars) any local variables belonging to the method.
50
45
  #
46
+ # @note
47
+ # Arguments to set_trace_func proc:
48
+ # |event, file, line, id, binding, name|
49
+ #
51
50
  # @todo Deprecate, and use TracePoint instead.
52
51
  #
53
52
  # @return [NilClass|String]
54
53
  def trace
55
- set_trace_func proc { |event, _file, _line, id, binding, name|
54
+ set_trace_func proc { |event, _, _, id, binding, name|
56
55
  if event == watched && id != :log && classes.include?(name.to_s)
57
56
  vars = variables(binding)
58
57
 
@@ -163,7 +162,7 @@ module Vedeu
163
162
  #
164
163
  # @return [Set]
165
164
  def vedeu_exceptions
166
- Vedeu::Exceptions.to_set
165
+ Vedeu::EXCEPTIONS.to_set
167
166
  end
168
167
 
169
168
  # Returns a set of classes to ignore during tracing.
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Change the visibility of the given model.
4
- #
5
4
  class Visibility
6
5
 
7
6
  # @param name [String]
@@ -70,7 +69,7 @@ module Vedeu
70
69
  end
71
70
  end
72
71
 
73
- private
72
+ protected
74
73
 
75
74
  # @!attribute [r] model
76
75
  # @return [void]
data/lib/vedeu.rb CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift($LIB_DIR) unless $LOAD_PATH.include?($LIB_DIR)
3
3
 
4
4
  require 'date'
5
5
  require 'drb'
6
+ require 'erb'
6
7
  require 'forwardable'
7
8
  require 'io/console'
8
9
  require 'json'
@@ -16,7 +17,6 @@ require 'time'
16
17
  require 'vedeu/support/log'
17
18
 
18
19
  # Vedeu is a GUI framework for terminal/console applications written in Ruby.
19
- #
20
20
  module Vedeu
21
21
 
22
22
  extend Forwardable
@@ -67,7 +67,7 @@ module Vedeu
67
67
  #
68
68
  # VedeuInterrupt: Raised when Vedeu wishes to exit.
69
69
  #
70
- Exceptions = %w(
70
+ EXCEPTIONS = %w(
71
71
  ModelNotFound
72
72
  InvalidSyntax
73
73
  MissingRequired
@@ -76,9 +76,7 @@ module Vedeu
76
76
  OutOfRange
77
77
  VedeuInterrupt
78
78
  )
79
- Exceptions.each { |e| const_set(e, Class.new(StandardError)) }
80
-
81
- private
79
+ EXCEPTIONS.each { |e| const_set(e, Class.new(StandardError)) }
82
80
 
83
81
  end # Vedeu
84
82