vedeu 0.4.40 → 0.4.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +23 -28
  3. data/Guardfile +0 -8
  4. data/Rakefile +0 -6
  5. data/docs/applications.md +0 -1
  6. data/docs/dsl.md +7 -12
  7. data/examples/borders_app.rb +5 -0
  8. data/examples/configuration_app.rb +5 -0
  9. data/examples/drb_app.rb +5 -0
  10. data/examples/geometry_app.rb +5 -0
  11. data/examples/material_colours_app.rb +5 -0
  12. data/examples/panel_app.rb +5 -0
  13. data/examples/typed_commands/typed_commands_app.rb +5 -0
  14. data/examples/view_templates_app/view_templates_app.rb +5 -0
  15. data/lib/vedeu/api.rb +8 -8
  16. data/lib/vedeu/application/all.rb +3 -0
  17. data/lib/vedeu/application/application_controller.rb +4 -0
  18. data/lib/vedeu/application/application_helper.rb +4 -0
  19. data/lib/vedeu/application/application_view.rb +6 -0
  20. data/lib/vedeu/application/controller.rb +23 -0
  21. data/lib/vedeu/application/helper.rb +23 -0
  22. data/lib/vedeu/application/view.rb +23 -0
  23. data/lib/vedeu/application.rb +1 -3
  24. data/lib/vedeu/bindings.rb +64 -65
  25. data/lib/vedeu/bootstrap.rb +2 -0
  26. data/lib/vedeu/buffers/buffer.rb +44 -0
  27. data/lib/vedeu/configuration/api.rb +44 -119
  28. data/lib/vedeu/configuration/cli.rb +2 -0
  29. data/lib/vedeu/configuration/configuration.rb +4 -20
  30. data/lib/vedeu/cursor/cursor.rb +7 -7
  31. data/lib/vedeu/cursor/reposition.rb +2 -0
  32. data/lib/vedeu/dsl/border.rb +58 -2
  33. data/lib/vedeu/dsl/composition.rb +5 -3
  34. data/lib/vedeu/dsl/geometry.rb +14 -5
  35. data/lib/vedeu/dsl/group.rb +2 -0
  36. data/lib/vedeu/dsl/interface.rb +23 -3
  37. data/lib/vedeu/dsl/keymap.rb +11 -6
  38. data/lib/vedeu/dsl/line.rb +8 -0
  39. data/lib/vedeu/dsl/menu.rb +3 -1
  40. data/lib/vedeu/dsl/presentation.rb +12 -3
  41. data/lib/vedeu/dsl/text.rb +2 -0
  42. data/lib/vedeu/dsl/view.rb +6 -1
  43. data/lib/vedeu/events/event.rb +3 -1
  44. data/lib/vedeu/generator/application.rb +2 -7
  45. data/lib/vedeu/generator/templates/application/app/models/keymaps/_global_.rb +5 -0
  46. data/lib/vedeu/generator/templates/application/app/views/interfaces/name.erb +10 -0
  47. data/lib/vedeu/generator/view.rb +2 -0
  48. data/lib/vedeu/geometry/geometry.rb +14 -0
  49. data/lib/vedeu/geometry/index_position.rb +1 -0
  50. data/lib/vedeu/geometry/position.rb +5 -0
  51. data/lib/vedeu/input/all.rb +0 -8
  52. data/lib/vedeu/input/input.rb +24 -8
  53. data/lib/vedeu/input/mapper.rb +5 -12
  54. data/lib/vedeu/models/composition.rb +3 -3
  55. data/lib/vedeu/models/escape_char.rb +2 -0
  56. data/lib/vedeu/models/focus.rb +8 -0
  57. data/lib/vedeu/models/interface.rb +1 -1
  58. data/lib/vedeu/models/line.rb +1 -5
  59. data/lib/vedeu/models/menu.rb +4 -2
  60. data/lib/vedeu/models/panel.rb +2 -0
  61. data/lib/vedeu/null/buffer.rb +2 -0
  62. data/lib/vedeu/null/interface.rb +2 -0
  63. data/lib/vedeu/output/background.rb +1 -1
  64. data/lib/vedeu/output/border.rb +5 -157
  65. data/lib/vedeu/output/compressor.rb +2 -0
  66. data/lib/vedeu/output/foreground.rb +1 -1
  67. data/lib/vedeu/output/refresh.rb +5 -9
  68. data/lib/vedeu/output/render_border.rb +230 -0
  69. data/lib/vedeu/output/renderers/escape_sequence.rb +2 -3
  70. data/lib/vedeu/output/renderers/file.rb +10 -9
  71. data/lib/vedeu/repositories/collections/all.rb +4 -4
  72. data/lib/vedeu/repositories/repositories/all.rb +4 -4
  73. data/lib/vedeu/repositories/repositories/{background_colours.rb → backgrounds.rb} +3 -3
  74. data/lib/vedeu/repositories/repositories/cursors.rb +3 -0
  75. data/lib/vedeu/repositories/repositories/{events_repository.rb → events.rb} +5 -5
  76. data/lib/vedeu/repositories/repositories/{foreground_colours.rb → foregrounds.rb} +3 -3
  77. data/lib/vedeu/repositories/repositories/{interfaces_repository.rb → interfaces.rb} +4 -4
  78. data/lib/vedeu/storage/associative_store.rb +2 -0
  79. data/lib/vedeu/storage/conveyor_store.rb +2 -0
  80. data/lib/vedeu/storage/fifo_store.rb +2 -0
  81. data/lib/vedeu/storage/store.rb +7 -7
  82. data/lib/vedeu/support/options.rb +2 -0
  83. data/lib/vedeu/support/terminal.rb +3 -3
  84. data/lib/vedeu/support/timer.rb +2 -0
  85. data/lib/vedeu/support/visibility.rb +2 -0
  86. data/lib/vedeu/templating/directive.rb +2 -0
  87. data/lib/vedeu/templating/preprocessor.rb +2 -0
  88. data/lib/vedeu/version.rb +1 -1
  89. data/lib/vedeu.rb +3 -1
  90. data/test/lib/vedeu/bindings_test.rb +15 -0
  91. data/test/lib/vedeu/buffers/buffer_test.rb +12 -0
  92. data/test/lib/vedeu/configuration/api_test.rb +0 -39
  93. data/test/lib/vedeu/configuration/configuration_test.rb +0 -9
  94. data/test/lib/vedeu/cursor/cursor_test.rb +6 -0
  95. data/test/lib/vedeu/dsl/border_test.rb +12 -0
  96. data/test/lib/vedeu/dsl/composition_test.rb +2 -2
  97. data/test/lib/vedeu/geometry/index_position_test.rb +2 -0
  98. data/test/lib/vedeu/geometry/position_test.rb +6 -0
  99. data/test/lib/vedeu/models/cell_test.rb +16 -8
  100. data/test/lib/vedeu/models/char_test.rb +8 -0
  101. data/test/lib/vedeu/models/composition_test.rb +2 -2
  102. data/test/lib/vedeu/models/interface_test.rb +10 -0
  103. data/test/lib/vedeu/models/line_test.rb +12 -0
  104. data/test/lib/vedeu/models/stream_test.rb +1 -13
  105. data/test/lib/vedeu/output/border_test.rb +1 -0
  106. data/test/lib/vedeu/output/presentation_test.rb +2 -0
  107. data/test/lib/vedeu/output/render_border_test.rb +16 -0
  108. data/test/lib/vedeu/output/renderers/file_test.rb +32 -16
  109. data/test/lib/vedeu/repositories/collection_test.rb +7 -0
  110. data/test/lib/vedeu/repositories/collections/all_test.rb +18 -6
  111. data/test/lib/vedeu/repositories/model_test.rb +33 -7
  112. data/test/lib/vedeu/repositories/repositories/{background_colours_test.rb → backgrounds_test.rb} +3 -3
  113. data/test/lib/vedeu/repositories/repositories/borders_test.rb +7 -17
  114. data/test/lib/vedeu/repositories/repositories/buffers_test.rb +7 -22
  115. data/test/lib/vedeu/repositories/repositories/cursors_test.rb +32 -0
  116. data/test/lib/vedeu/repositories/repositories/events_test.rb +22 -0
  117. data/test/lib/vedeu/repositories/repositories/{foreground_colours_test.rb → foregrounds_test.rb} +3 -3
  118. data/test/lib/vedeu/repositories/repositories/geometries_test.rb +7 -21
  119. data/test/lib/vedeu/repositories/repositories/groups_test.rb +11 -0
  120. data/test/lib/vedeu/repositories/repositories/{interfaces_repositories_test.rb → interfaces_test.rb} +14 -3
  121. data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +10 -1
  122. data/test/lib/vedeu/repositories/repositories/menus_test.rb +10 -1
  123. data/test/lib/vedeu/repositories/repository_test.rb +15 -9
  124. data/test/lib/vedeu/storage/conveyor_store_test.rb +2 -4
  125. data/test/lib/vedeu/support/terminal_test.rb +2 -2
  126. data/test/lib/vedeu/templating/helpers_test.rb +4 -0
  127. data/vedeu.gemspec +0 -2
  128. metadata +20 -54
  129. data/config/cucumber.yml +0 -8
  130. data/features/cli_vedeu.feature +0 -5
  131. data/features/start_stop.feature +0 -27
  132. data/features/step_definitions/vedeu_steps.rb +0 -0
  133. data/features/support/env.rb +0 -15
  134. data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +0 -7
  135. data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +0 -13
  136. data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +0 -11
@@ -0,0 +1,230 @@
1
+ module Vedeu
2
+
3
+ class RenderBorder
4
+
5
+ extend Forwardable
6
+ include Vedeu::Common
7
+
8
+ def_delegators :border,
9
+ :bottom?,
10
+ :bottom_left,
11
+ :bottom_right,
12
+ :bx,
13
+ :bxn,
14
+ :by,
15
+ :byn,
16
+ :colour,
17
+ :enabled?,
18
+ :height,
19
+ :horizontal,
20
+ :left?,
21
+ :name,
22
+ :right?,
23
+ :style,
24
+ :title,
25
+ :top?,
26
+ :top_left,
27
+ :top_right,
28
+ :width,
29
+ :vertical
30
+
31
+ def_delegators :geometry,
32
+ :x,
33
+ :xn,
34
+ :y,
35
+ :yn
36
+
37
+ def_delegators :interface,
38
+ :visible?
39
+
40
+ # @return [Array<Array<Vedeu::Char>>]
41
+ # @see Vedeu::RenderBorder#initialize
42
+ def self.with(border)
43
+ new(border).render
44
+ end
45
+
46
+ # Returns a new instance of Vedeu::RenderBorder.
47
+ #
48
+ # @param border [Vedeu::Border]
49
+ # @return [Vedeu::Renderers::Border]
50
+ def initialize(border)
51
+ @border = border
52
+ end
53
+
54
+ # @return [Array<Array<Vedeu::Char>>]
55
+ def render
56
+ return [] unless visible?
57
+ return [] unless enabled?
58
+
59
+ Vedeu.timer("Rendering border: #{name}") do
60
+ out = [top, bottom]
61
+
62
+ height.times do |y|
63
+ out << [left(y), right(y)]
64
+ end
65
+
66
+ out.flatten
67
+ end
68
+ end
69
+
70
+ protected
71
+
72
+ # @!attribute [r] border
73
+ # @return [Vedeu::Border]
74
+ attr_reader :border
75
+
76
+ private
77
+
78
+ # @param value [String]
79
+ # @param type [Symbol|NilClass]
80
+ # @param iy [Fixnum]
81
+ # @param ix [Fixnum]
82
+ # @return [Vedeu::Char]
83
+ def build(value, type = :border, iy = 0, ix = 0)
84
+ Vedeu::Char.new(value: value,
85
+ parent: interface,
86
+ colour: colour,
87
+ style: style,
88
+ position: Vedeu::Position[iy, ix],
89
+ border: type)
90
+ end
91
+
92
+ # Renders the bottom border for the interface.
93
+ #
94
+ # @return [String]
95
+ def bottom
96
+ return [] unless bottom?
97
+
98
+ out = []
99
+ out << build(bottom_left, :bottom_left, *[yn, x]) if left?
100
+ out << horizontal_border(:bottom_horizontal, yn)
101
+ out << build(bottom_right, :bottom_right, *[yn, xn]) if right?
102
+ out
103
+ end
104
+
105
+ # @return [Vedeu::Geometry]
106
+ def geometry
107
+ Vedeu.geometries.by_name(name)
108
+ end
109
+
110
+ # @param position [Symbol] Either :top_horizontal, or :bottom_horizontal.
111
+ # @return [Array<Vedeu::Char>]
112
+ def horizontal_border(position, y_coordinate)
113
+ width.times.each_with_object([]) do |ix, a|
114
+ a << build(horizontal, position, *[y_coordinate, (bx + ix)])
115
+ end
116
+ end
117
+
118
+ # The parent of a border is always an interface.
119
+ #
120
+ # @return [Vedeu::Interface]
121
+ def interface
122
+ @interface ||= Vedeu.interfaces.by_name(name)
123
+ end
124
+ alias_method :parent, :interface
125
+
126
+ # Renders the left border for the interface.
127
+ #
128
+ # @param iy [Fixnum]
129
+ # @return [String]
130
+ def left(iy = 0)
131
+ return [] unless left?
132
+
133
+ build(vertical, :left_vertical, *[(by + iy), x])
134
+ end
135
+
136
+ # Pads the title with a single whitespace either side.
137
+ #
138
+ # @example
139
+ # title = 'Truncated!'
140
+ # width = 20
141
+ # # => ' Truncated! '
142
+ #
143
+ # width = 10
144
+ # # => ' Trunca '
145
+ #
146
+ # @return [String]
147
+ # @see #truncated_title
148
+ def padded_title
149
+ truncated_title.center(truncated_title.size + 2)
150
+ end
151
+
152
+ # Renders the right border for the interface.
153
+ #
154
+ # @param iy [Fixnum]
155
+ # @return [String]
156
+ def right(iy = 0)
157
+ return [] unless right?
158
+
159
+ build(vertical, :right_vertical, *[(by + iy), xn])
160
+ end
161
+
162
+ # Return boolean indicating whether this border has a non-empty title.
163
+ #
164
+ # @return [Boolean]
165
+ def title?
166
+ present?(title)
167
+ end
168
+
169
+ # From the second element of {#title_characters} remove the border from each
170
+ # {#horizontal_border} Vedeu::Char, and add the title character.
171
+ #
172
+ # @return [Array<Vedeu::Char>]
173
+ def titlebar
174
+ horizontal_border(:top_horizontal, y).each_with_index do |char, index|
175
+ if index >= 1 && index <= title_characters.size
176
+ char.border = nil
177
+ char.value = title_characters[(index - 1)]
178
+ end
179
+ end
180
+ end
181
+
182
+ # @return [Array<String>]
183
+ def title_characters
184
+ @title_characters ||= padded_title.chars
185
+ end
186
+
187
+ # Renders the top border for the interface.
188
+ #
189
+ # @note
190
+ # If a title has been specified, then the top border will include this
191
+ # title unless the size of the interface is smaller than the padded title
192
+ # length.
193
+ #
194
+ # @return [String]
195
+ def top
196
+ return [] unless top?
197
+
198
+ out = []
199
+ out << build(top_left, :top_left, *[y, x]) if left?
200
+ if title? && width > title_characters.size
201
+ out << titlebar
202
+
203
+ else
204
+ out << horizontal_border(:top_horizontal, y)
205
+
206
+ end
207
+ out << build(top_right, :top_right, *[y, xn]) if right?
208
+ out
209
+ end
210
+
211
+ # Truncates the title to the width of the interface, minus characters needed
212
+ # to ensure there is at least a single character of horizontal border and a
213
+ # whitespace on either side of the title.
214
+ #
215
+ # @example
216
+ # title = 'Truncated!'
217
+ # width = 20
218
+ # # => 'Truncated!'
219
+ #
220
+ # width = 10
221
+ # # => 'Trunca'
222
+ #
223
+ # @return [String]
224
+ def truncated_title
225
+ title.chomp.slice(0..(width - 5))
226
+ end
227
+
228
+ end # RenderBorder
229
+
230
+ end # Vedeu
@@ -13,6 +13,8 @@ module Vedeu
13
13
  new(output).render
14
14
  end
15
15
 
16
+ # Returns a new instance of Vedeu::Renderers::EscapeSequence.
17
+ #
16
18
  # @param output [Array<Array<Vedeu::Char>>]
17
19
  def initialize(output)
18
20
  @output = output
@@ -20,9 +22,6 @@ module Vedeu
20
22
 
21
23
  # @return [String]
22
24
  def render
23
- Vedeu.log(type: :debug,
24
- message: "#{self.class.name}:\n#{parsed}")
25
-
26
25
  parsed
27
26
  end
28
27
 
@@ -2,24 +2,24 @@ module Vedeu
2
2
 
3
3
  module Renderers
4
4
 
5
- # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
- # and content suitable for a terminal, and writes them to a file in the /tmp
7
- # directory.
5
+ # Writes the given output to a file.
8
6
  #
9
7
  # @api private
10
8
  class File
11
9
 
12
- # @param output [Array<Array<Vedeu::Char>>]
13
- # @param options [Hash]
14
10
  # @return [String]
11
+ # @see Vedeu::Renderers::File#initialize
15
12
  def self.render(output, options = {})
16
13
  new(output, options).render
17
14
  end
18
15
 
19
16
  # Returns a new instance of Vedeu::Renderers::File.
20
17
  #
21
- # @param output [Array<Array<Vedeu::Char>>]
18
+ # @param output [String]
22
19
  # @param options [Hash]
20
+ # @option options filename [String] Provide a filename for the output.
21
+ # Defaults to 'out'.
22
+ # @option options timestamp [Boolean] Append a timestamp to the filename.
23
23
  # @return [Vedeu::Renderers::File]
24
24
  def initialize(output, options = {})
25
25
  @output = output
@@ -36,7 +36,7 @@ module Vedeu
36
36
  protected
37
37
 
38
38
  # @!attribute [r] output
39
- # @return [Array<Array<Vedeu::Char>>]
39
+ # @return [String]
40
40
  attr_reader :output
41
41
  alias_method :parsed, :output
42
42
 
@@ -50,10 +50,10 @@ module Vedeu
50
50
  # @return [String]
51
51
  def filename
52
52
  if timestamp?
53
- "out_#{timestamp}"
53
+ "#{options[:filename]}_#{timestamp}"
54
54
 
55
55
  else
56
- 'out'
56
+ options[:filename]
57
57
 
58
58
  end
59
59
  end
@@ -78,6 +78,7 @@ module Vedeu
78
78
  # @return [Hash]
79
79
  def defaults
80
80
  {
81
+ filename: 'out',
81
82
  timestamp: false,
82
83
  }
83
84
  end
@@ -12,16 +12,16 @@ module Vedeu
12
12
  # A collection of {Vedeu::Event} instances.
13
13
  #
14
14
  # @api private
15
- class Events < Vedeu::Collection
15
+ class EventCollection < Vedeu::Collection
16
16
 
17
- end # Events
17
+ end # EventCollection
18
18
 
19
19
  # A collection of {Vedeu::Interface} instances.
20
20
  #
21
21
  # @api private
22
- class Interfaces < Vedeu::Collection
22
+ class InterfaceCollection < Vedeu::Collection
23
23
 
24
- end # Interfaces
24
+ end # InterfaceCollection
25
25
 
26
26
  # A collection of {Vedeu::Key} instances.
27
27
  #
@@ -1,14 +1,14 @@
1
1
  require 'vedeu/repositories/repository'
2
2
 
3
3
  require_relative 'colours'
4
- require_relative 'background_colours'
5
- require_relative 'foreground_colours'
4
+ require_relative 'backgrounds'
5
+ require_relative 'foregrounds'
6
6
  require_relative 'borders'
7
7
  require_relative 'buffers'
8
8
  require_relative 'cursors'
9
- require_relative 'events_repository'
9
+ require_relative 'events'
10
10
  require_relative 'geometries'
11
11
  require_relative 'groups'
12
- require_relative 'interfaces_repository'
12
+ require_relative 'interfaces'
13
13
  require_relative 'keymaps'
14
14
  require_relative 'menus'
@@ -3,16 +3,16 @@ module Vedeu
3
3
  # Store background colour escape sequences by HTML/CSS code.
4
4
  #
5
5
  # @api public
6
- class BackgroundColours < Colours
6
+ class Backgrounds < Colours
7
7
 
8
8
  # @example
9
9
  # Vedeu.background_colours
10
10
  #
11
- # @return [Vedeu::BackgroundColours]
11
+ # @return [Vedeu::Backgrounds]
12
12
  def self.background_colours
13
13
  @background_colours ||= new
14
14
  end
15
15
 
16
- end # BackgroundColours
16
+ end # Backgrounds
17
17
 
18
18
  end # Vedeu
@@ -45,6 +45,9 @@ module Vedeu
45
45
  elsif name
46
46
  Vedeu::Cursor.new(name: name).store
47
47
 
48
+ else
49
+ Vedeu::Cursor.new(name: Vedeu.focus).store
50
+
48
51
  end
49
52
  end
50
53
 
@@ -3,14 +3,14 @@ module Vedeu
3
3
  # Allows the storing of events.
4
4
  #
5
5
  # @api public
6
- class EventsRepository < Repository
6
+ class Events < Repository
7
7
 
8
8
  class << self
9
9
 
10
10
  # @example
11
11
  # Vedeu.events
12
12
  #
13
- # @return [Vedeu::EventsRepository]
13
+ # @return [Vedeu::Events]
14
14
  alias_method :events, :repository
15
15
 
16
16
  # Remove all stored models from the repository.
@@ -18,13 +18,13 @@ module Vedeu
18
18
  # @example
19
19
  # Vedeu.events.reset
20
20
  #
21
- # @return [Vedeu::EventsRepository]
21
+ # @return [Vedeu::Events]
22
22
  def reset!
23
- @events = new(Vedeu::Events)
23
+ @events = new(Vedeu::EventCollection)
24
24
  end
25
25
 
26
26
  end
27
27
 
28
- end # EventsRepository
28
+ end # Events
29
29
 
30
30
  end # Vedeu
@@ -3,16 +3,16 @@ module Vedeu
3
3
  # Store foreground colour escape sequences by HTML/CSS code.
4
4
  #
5
5
  # @api public
6
- class ForegroundColours < Colours
6
+ class Foregrounds < Colours
7
7
 
8
8
  # @example
9
9
  # Vedeu.foreground_colours
10
10
  #
11
- # @return [Vedeu::ForegroundColours]
11
+ # @return [Vedeu::Foregrounds]
12
12
  def self.foreground_colours
13
13
  @foreground_colours ||= new
14
14
  end
15
15
 
16
- end # ForegroundColours
16
+ end # Foregrounds
17
17
 
18
18
  end # Vedeu
@@ -3,14 +3,14 @@ module Vedeu
3
3
  # Allows the storing of interfaces and views.
4
4
  #
5
5
  # @api public
6
- class InterfacesRepository < Repository
6
+ class Interfaces < Repository
7
7
 
8
8
  class << self
9
9
 
10
10
  # @example
11
11
  # Vedeu.interfaces
12
12
  #
13
- # @return [Vedeu::InterfacesRepository]
13
+ # @return [Vedeu::Interfaces]
14
14
  alias_method :interfaces, :repository
15
15
 
16
16
  # Remove all stored models from the repository.
@@ -18,7 +18,7 @@ module Vedeu
18
18
  # @example
19
19
  # Vedeu.interfaces.reset!
20
20
  #
21
- # @return [Vedeu::InterfacesRepository]
21
+ # @return [Vedeu::Interfaces]
22
22
  def reset!
23
23
  @interfaces = register(Vedeu::Interface)
24
24
  end
@@ -39,6 +39,6 @@ module Vedeu
39
39
  all.sort { |a, b| a.zindex <=> b.zindex }
40
40
  end
41
41
 
42
- end # InterfacesRepository
42
+ end # Interfaces
43
43
 
44
44
  end # Vedeu
@@ -9,6 +9,8 @@ module Vedeu
9
9
 
10
10
  include Vedeu::Store
11
11
 
12
+ # Returns a new instance of Vedeu::AssociativeStore.
13
+ #
12
14
  # @param storage [Hash]
13
15
  # @return [Vedeu::AssociativeStore]
14
16
  def initialize(storage = {})
@@ -8,6 +8,8 @@ module Vedeu
8
8
 
9
9
  include Vedeu::Store
10
10
 
11
+ # Returns a new instance of Vedeu::ConveyorStore.
12
+ #
11
13
  # @param storage [Array]
12
14
  # @return [Vedeu::ConveyorStore]
13
15
  def initialize(storage = [])
@@ -9,6 +9,8 @@ module Vedeu
9
9
 
10
10
  include Vedeu::Store
11
11
 
12
+ # Returns a new instance of Vedeu::FifoStore.
13
+ #
12
14
  # @param storage [Array]
13
15
  # @return [Vedeu::FifoStore]
14
16
  def initialize(storage = [])
@@ -13,6 +13,13 @@ module Vedeu
13
13
  storage.each(&block)
14
14
  end
15
15
 
16
+ # Return a boolean indicating whether the storage is empty.
17
+ #
18
+ # @return [Boolean]
19
+ def empty?
20
+ storage.empty?
21
+ end
22
+
16
23
  # Returns a boolean indicating whether the named model is registered.
17
24
  #
18
25
  # @param name [String]
@@ -24,13 +31,6 @@ module Vedeu
24
31
  end
25
32
  alias_method :registered?, :exists?
26
33
 
27
- # Return a boolean indicating whether the storage is empty.
28
- #
29
- # @return [Boolean]
30
- def empty?
31
- storage.empty?
32
- end
33
-
34
34
  # Remove all currently stored data.
35
35
  #
36
36
  # @return [Array|Hash|Set]
@@ -17,6 +17,8 @@ module Vedeu
17
17
  new(options)._build
18
18
  end
19
19
 
20
+ # Returns a new instance of Vedeu::Options.
21
+ #
20
22
  # @param options [Hash]
21
23
  # @return [Vedeu::Options]
22
24
  def initialize(options = {})
@@ -39,14 +39,14 @@ module Vedeu
39
39
  keys_or_cmd = if raw_mode?
40
40
  keys = console.getch
41
41
 
42
- if keys.ord == 27
42
+ if keys.ord == 27 # \e
43
43
  begin
44
- keys << console.read_nonblock(3)
44
+ keys << console.read_nonblock(5)
45
45
  rescue
46
46
  nil
47
47
  end
48
48
  begin
49
- keys << console.read_nonblock(2)
49
+ keys << console.read_nonblock(4)
50
50
  rescue
51
51
  nil
52
52
  end
@@ -21,6 +21,8 @@ module Vedeu
21
21
 
22
22
  end
23
23
 
24
+ # Returns a new instance of Vedeu::Timer.
25
+ #
24
26
  # @param message [String]
25
27
  # @return [Vedeu::Timer]
26
28
  def initialize(message = '')
@@ -31,6 +31,8 @@ module Vedeu
31
31
  new(model).toggle
32
32
  end
33
33
 
34
+ # Returns a new instance of Vedeu::Visibility.
35
+ #
34
36
  # @param model [void]
35
37
  # @return [Vedeu::Visibility]
36
38
  def initialize(model)
@@ -15,6 +15,8 @@ module Vedeu
15
15
  new(code).process
16
16
  end
17
17
 
18
+ # Returns a new instance of Vedeu::Templating::Directive.
19
+ #
18
20
  # @param code [String]
19
21
  # @return [Vedeu::Templating::Directive]
20
22
  def initialize(code)
@@ -24,6 +24,8 @@ module Vedeu
24
24
  new(lines).process
25
25
  end
26
26
 
27
+ # Returns a new instance of Vedeu::Templating::Preprocessor.
28
+ #
27
29
  # @param lines [Array<String>]
28
30
  # @return [Vedeu::Templating::Preprocessor]
29
31
  def initialize(lines)
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.4.40'
4
+ VERSION = '0.4.41'
5
5
 
6
6
  end
data/lib/vedeu.rb CHANGED
@@ -36,7 +36,9 @@ module Vedeu
36
36
  # @example
37
37
  # class YourClassHere
38
38
  # include Vedeu
39
- # ...
39
+ #
40
+ # # ...
41
+ # end
40
42
  #
41
43
  # @param receiver []
42
44
  # @return [void]
@@ -25,6 +25,8 @@ module Vedeu
25
25
  context 'the cursor specific events are defined' do
26
26
  it { Vedeu.events.registered?(:_cursor_hide_).must_equal(true) }
27
27
  it { Vedeu.events.registered?(:_cursor_show_).must_equal(true) }
28
+ it { Vedeu.events.registered?(:_hide_cursor_).must_equal(true) }
29
+ it { Vedeu.events.registered?(:_show_cursor_).must_equal(true) }
28
30
  it { Vedeu.events.registered?(:_cursor_down_).must_equal(true) }
29
31
  it { Vedeu.events.registered?(:_cursor_left_).must_equal(true) }
30
32
  it { Vedeu.events.registered?(:_cursor_right_).must_equal(true) }
@@ -35,6 +37,15 @@ module Vedeu
35
37
  it { Vedeu.events.registered?(:_cursor_reset_).must_equal(true) }
36
38
  end
37
39
 
40
+ context 'the geometry specific events are defined' do
41
+ it { Vedeu.events.registered?(:_geometry_down_).must_equal(true) }
42
+ it { Vedeu.events.registered?(:_geometry_left_).must_equal(true) }
43
+ it { Vedeu.events.registered?(:_geometry_right_).must_equal(true) }
44
+ it { Vedeu.events.registered?(:_geometry_up_).must_equal(true) }
45
+ it { Vedeu.events.registered?(:_maximise_).must_equal(true) }
46
+ it { Vedeu.events.registered?(:_unmaximise_).must_equal(true) }
47
+ end
48
+
38
49
  context 'the drb specific events are defined' do
39
50
  it { Vedeu.events.registered?(:_drb_input_).must_equal(true) }
40
51
  it { Vedeu.events.registered?(:_drb_retrieve_output_).must_equal(true) }
@@ -68,6 +79,10 @@ module Vedeu
68
79
  it { Vedeu.events.registered?(:_refresh_).must_equal(true) }
69
80
  end
70
81
 
82
+ it { Vedeu.events.registered?(:_hide_interface_).must_equal(true) }
83
+ it { Vedeu.events.registered?(:_show_interface_).must_equal(true) }
84
+ it { Vedeu.events.registered?(:_toggle_interface_).must_equal(true) }
85
+
71
86
  end # Bindings
72
87
 
73
88
  end # Vedeu
@@ -198,6 +198,18 @@ module Vedeu
198
198
  end
199
199
  end
200
200
 
201
+ describe '#toggle' do
202
+ subject { instance.toggle }
203
+
204
+ context 'when the interface is visible' do
205
+ # it { skip }
206
+ end
207
+
208
+ context 'when the interface is not visible' do
209
+ # it { skip }
210
+ end
211
+ end
212
+
201
213
  describe '#render' do
202
214
  before { Vedeu::Output.stubs(:render) }
203
215