vedeu 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/docs/events.md +0 -12
  4. data/examples/configuration_app.rb +1 -1
  5. data/lib/vedeu/all.rb +0 -1
  6. data/lib/vedeu/bindings.rb +18 -3
  7. data/lib/vedeu/buffers/display_buffer.rb +0 -22
  8. data/lib/vedeu/configuration/api.rb +8 -44
  9. data/lib/vedeu/configuration/cli.rb +6 -36
  10. data/lib/vedeu/configuration/configuration.rb +0 -4
  11. data/lib/vedeu/distributed/server.rb +4 -10
  12. data/lib/vedeu/dsl/components/keymap.rb +3 -5
  13. data/lib/vedeu/input/keymap.rb +22 -45
  14. data/lib/vedeu/main_loop.rb +2 -0
  15. data/lib/vedeu/models/focus.rb +1 -1
  16. data/lib/vedeu/models/geometry.rb +2 -2
  17. data/lib/vedeu/models/view/char.rb +1 -1
  18. data/lib/vedeu/models/view/composition.rb +1 -1
  19. data/lib/vedeu/models/view/interface.rb +4 -2
  20. data/lib/vedeu/models/view/line.rb +1 -2
  21. data/lib/vedeu/models/view/stream.rb +1 -1
  22. data/lib/vedeu/output/all.rb +8 -0
  23. data/lib/vedeu/{presentation → output}/background.rb +0 -0
  24. data/lib/vedeu/{presentation → output}/colour.rb +0 -0
  25. data/lib/vedeu/{presentation → output}/foreground.rb +1 -1
  26. data/lib/vedeu/output/html_renderer.rb +13 -30
  27. data/lib/vedeu/{presentation → output}/presentation.rb +0 -0
  28. data/lib/vedeu/{presentation → output}/style.rb +0 -0
  29. data/lib/vedeu/output/templates/html_renderer.vedeu +24 -0
  30. data/lib/vedeu/{presentation → output}/translator.rb +0 -0
  31. data/lib/vedeu/support/log.rb +1 -0
  32. data/test/integration/dsl/compositions_test.rb +0 -8
  33. data/test/integration/dsl/interfaces_test.rb +0 -68
  34. data/test/integration/dsl/keymaps_test.rb +0 -12
  35. data/test/integration/dsl/lines_test.rb +0 -42
  36. data/test/integration/dsl/streams_test.rb +0 -26
  37. data/test/integration/dsl/views_test.rb +0 -18
  38. data/test/lib/vedeu/api_test.rb +0 -97
  39. data/test/lib/vedeu/configuration/api_test.rb +3 -14
  40. data/test/lib/vedeu/configuration/cli_test.rb +0 -14
  41. data/test/lib/vedeu/cursor/cursor_test.rb +0 -2
  42. data/test/lib/vedeu/distributed/client_test.rb +0 -2
  43. data/test/lib/vedeu/distributed/test_application_test.rb +0 -1
  44. data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -7
  45. data/test/lib/vedeu/dsl/components/menu_test.rb +0 -48
  46. data/test/lib/vedeu/dsl/interface_test.rb +1 -263
  47. data/test/lib/vedeu/dsl/shared/text_test.rb +0 -6
  48. data/test/lib/vedeu/dsl/stream_test.rb +0 -2
  49. data/test/lib/vedeu/events/event_test.rb +0 -1
  50. data/test/lib/vedeu/input/keymap_test.rb +8 -2
  51. data/test/lib/vedeu/input/mapper_test.rb +2 -2
  52. data/test/lib/vedeu/launcher_test.rb +0 -12
  53. data/test/lib/vedeu/main_loop_test.rb +0 -17
  54. data/test/lib/vedeu/models/focus_test.rb +59 -19
  55. data/test/lib/vedeu/models/geometry_test.rb +20 -26
  56. data/test/lib/vedeu/models/view/interface_test.rb +0 -27
  57. data/test/lib/vedeu/models/view/stream_test.rb +0 -1
  58. data/test/lib/vedeu/{presentation → output}/background_test.rb +0 -0
  59. data/test/lib/vedeu/{presentation → output}/colour_test.rb +0 -0
  60. data/test/lib/vedeu/output/compositor_test.rb +0 -5
  61. data/test/lib/vedeu/{presentation → output}/foreground_test.rb +0 -0
  62. data/test/lib/vedeu/output/html_renderer_test.rb +1 -0
  63. data/test/lib/vedeu/{presentation → output}/presentation_test.rb +0 -0
  64. data/test/lib/vedeu/{presentation → output}/style_test.rb +0 -0
  65. data/test/lib/vedeu/{presentation → output}/translator_test.rb +0 -0
  66. data/test/lib/vedeu/output/writer_test.rb +8 -21
  67. data/test/lib/vedeu/repositories/repository_test.rb +0 -24
  68. data/test/lib/vedeu/support/refresh_test.rb +0 -10
  69. data/test/support/helpers/model_test_class.rb +1 -1
  70. data/vedeu.gemspec +1 -1
  71. metadata +22 -22
  72. data/lib/vedeu/presentation/all.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c55cc711fc37aa01aeaba23c8ababc6c983801c4
4
- data.tar.gz: e86bdcf954386935f4710649322622de5afadb3e
3
+ metadata.gz: 50414317727dc7045eeb48bcc676bf11fd67a06b
4
+ data.tar.gz: c4d967105b00a59ddda739d06373b9a63653e3f9
5
5
  SHA512:
6
- metadata.gz: 78f9a8eb02a9b61bdb6f9c0943f016bce77f4747d327d93ea62fc56b024a457af78b4268095ef3141a7085fb500de741ba0dee15c114ccb5715bf819444cc0ec
7
- data.tar.gz: cd92b729793a54269549769f3ca235e465297cd6eedf92e752fb1eb72e9a12d1991b55a540466c455684b1fe986e24ab840e28c57b34c92acacaefbde0562b32
6
+ metadata.gz: 02424b6a19fb5f4d88ea39e7502cf47f2b56a2401c84504f6da103fd358109665060a4420f24700bd24580c7656c8b2646ceb759ff4d4ab82c2f03bccca19366
7
+ data.tar.gz: c5eac73a0ad542d6178a6fb8a3998b1a4d6404770d2b320c06e2e173cc53768a2ef710f8dd75e700058be4f4a427df604a9b659293389e63749bf522fca4f624
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2
1
+ 2.1
data/docs/events.md CHANGED
@@ -11,18 +11,6 @@ class SomeClassInYourApplication
11
11
  # ...
12
12
  ```
13
13
 
14
- ## System Events
15
-
16
- System events generally control the internal state of Vedeu with respects to your application. They are soft-namespaced using underscores.
17
-
18
- ### `:_refresh_group_(group_name)_`
19
-
20
- Will refresh all interfaces belonging to this group. E.g. `_refresh_group_home_` will refresh all interfaces with the group of `home`.
21
-
22
- ### `:_refresh_(interface_name)_`
23
-
24
- Will refresh the interface with this name. E.g. `_refresh_widget_` will refresh the interface `widget`.
25
-
26
14
 
27
15
  ##### Notes:
28
16
 
@@ -44,7 +44,7 @@ class VedeuConfigurationApp
44
44
  end
45
45
 
46
46
  keymap('config') do
47
- key(' ') { Vedeu.trigger(:_refresh_config_) }
47
+ key(' ') { Vedeu.trigger(:_refresh_, 'config') }
48
48
  end
49
49
 
50
50
  def self.start(argv = ARGV)
data/lib/vedeu/all.rb CHANGED
@@ -24,7 +24,6 @@ require 'vedeu/events/all'
24
24
  require 'vedeu/input/all'
25
25
  require 'vedeu/models/all'
26
26
  require 'vedeu/output/all'
27
- require 'vedeu/presentation/all'
28
27
  require 'vedeu/support/all'
29
28
 
30
29
  require 'vedeu/main_loop'
@@ -9,7 +9,7 @@ module Vedeu
9
9
  end
10
10
 
11
11
  # Creates system events which when called provide a variety of core functions
12
- # and behaviours.
12
+ # and behaviours. They are soft-namespaced using underscores.
13
13
  #
14
14
  # @note
15
15
  # Unbinding any of these events is likely to cause problems, so I would
@@ -219,8 +219,23 @@ module Vedeu
219
219
  # starting at the current item to the last item.
220
220
  Vedeu.bind(:_menu_view_) { |name| Vedeu.menus.find(name).view }
221
221
 
222
- # Triggering this event will cause all interfaces to refresh.
223
- Vedeu.bind(:_refresh_) { Vedeu::Refresh.all }
222
+ # Triggering this event will cause all interfaces to refresh, or the named
223
+ # interface if one is given.
224
+ Vedeu.bind(:_refresh_) do |name|
225
+ if name
226
+ Vedeu::Refresh.by_name(name)
227
+
228
+ else
229
+ Vedeu::Refresh.all
230
+
231
+ end
232
+ end
233
+
234
+ # Triggering this event will cause all interfaces in the named group to
235
+ # refresh.
236
+ Vedeu.bind(:_refresh_group_) do |name|
237
+ Vedeu::Refresh.by_group(name)
238
+ end
224
239
 
225
240
  end # Bindings
226
241
  # :nocov:
@@ -55,28 +55,6 @@ module Vedeu
55
55
  self
56
56
  end
57
57
 
58
- # Registers refresh events for the interface unless already registered.
59
- #
60
- # @return [Interface]
61
- def store_refresh_events
62
- options = { delay: delay }
63
- event = "_refresh_#{name}_".to_sym
64
-
65
- unless Vedeu.events.registered?(event)
66
- Vedeu.bind(event, options) { Vedeu::Refresh.by_name(name) }
67
- end
68
-
69
- unless group.nil? || group.empty?
70
- event = "_refresh_group_#{group}_".to_sym
71
-
72
- unless Vedeu.events.registered?(event)
73
- Vedeu.bind(event, options) { Vedeu::Refresh.by_group(group) }
74
- end
75
- end
76
-
77
- self
78
- end
79
-
80
58
  # Registers interface name in focus list unless already registered.
81
59
  #
82
60
  # @return [Interface]
@@ -39,14 +39,12 @@ module Vedeu
39
39
  #
40
40
  # @return [Hash]
41
41
  def configuration
42
- if system_keys.any?
43
- options.merge({
44
- system_keys: Configuration.default_system_keys.merge(system_keys)
45
- })
46
-
47
- else
48
- options
42
+ options.merge!({
43
+ system_keys: Configuration.default_system_keys.merge(system_keys)
44
+ }) if system_keys.any?
49
45
 
46
+ options.each do |option, value|
47
+ Vedeu.log(type: :config, message: "API #{option.to_s}: #{value.to_s}")
50
48
  end
51
49
  end
52
50
 
@@ -65,8 +63,6 @@ module Vedeu
65
63
  # @param value [Boolean]
66
64
  # @return [Boolean]
67
65
  def interactive!(value = true)
68
- Vedeu.log(type: :info, message: "Configuration::API interactive: #{value}")
69
-
70
66
  options[:interactive] = value
71
67
  end
72
68
  alias_method :interactive, :interactive!
@@ -82,8 +78,6 @@ module Vedeu
82
78
  # @param value [Boolean]
83
79
  # @return [Boolean]
84
80
  def standalone!(value = true)
85
- Vedeu.log(type: :info, message: "Configuration::API interactive: #{!value}")
86
-
87
81
  options[:interactive] = !value
88
82
  end
89
83
  alias_method :standalone, :standalone!
@@ -100,8 +94,6 @@ module Vedeu
100
94
  # @param value [Boolean]
101
95
  # @return [Boolean]
102
96
  def run_once!(value = true)
103
- Vedeu.log(type: :info, message: "Configuration::API once: #{value}")
104
-
105
97
  options[:once] = value
106
98
  end
107
99
  alias_method :run_once, :run_once!
@@ -116,8 +108,6 @@ module Vedeu
116
108
  # @param value [Boolean]
117
109
  # @return [Boolean]
118
110
  def drb!(value = true)
119
- Vedeu.log(type: :info, message: "Configuration::API drb: #{value}")
120
-
121
111
  options[:drb] = value
122
112
  end
123
113
  alias_method :drb, :drb!
@@ -183,8 +173,6 @@ module Vedeu
183
173
  #
184
174
  # @return [Boolean]
185
175
  def cooked!
186
- Vedeu.log(type: :info, message: "Configuration::API terminal_mode: :cooked")
187
-
188
176
  options[:terminal_mode] = :cooked
189
177
  end
190
178
  alias_method :cooked, :cooked!
@@ -198,8 +186,6 @@ module Vedeu
198
186
  #
199
187
  # @return [Boolean]
200
188
  def raw!
201
- Vedeu.log(type: :info, message: "Configuration::API terminal_mode: :raw")
202
-
203
189
  options[:terminal_mode] = :raw
204
190
  end
205
191
  alias_method :raw, :raw!
@@ -222,13 +208,9 @@ module Vedeu
222
208
  # @return [Boolean]
223
209
  def debug!(value = true)
224
210
  if options.key?(:trace) && options[:trace] != false
225
- Vedeu.log(type: :info, message: "Configuration::API debug: true")
226
-
227
211
  options[:debug] = true
228
212
 
229
213
  else
230
- Vedeu.log(type: :info, message: "Configuration::API debug: #{value}")
231
-
232
214
  options[:debug] = value
233
215
 
234
216
  end
@@ -252,9 +234,6 @@ module Vedeu
252
234
  # @return [Boolean]
253
235
  def trace!(value = true)
254
236
  options[:debug] = true if value === true
255
-
256
- Vedeu.log(type: :info, message: "Configuration::API trace: #{value}")
257
-
258
237
  options[:trace] = value
259
238
  end
260
239
  alias_method :trace, :trace!
@@ -273,9 +252,6 @@ module Vedeu
273
252
  def colour_mode(value = nil)
274
253
  fail InvalidSyntax, '`colour_mode` must be `8`, `16`, `256`, ' \
275
254
  '`16777216`.' unless valid_colour_mode?(value)
276
-
277
- Vedeu.log(type: :info, message: "Configuration::API colour_mode: #{value}")
278
-
279
255
  options[:colour_mode] = value
280
256
  end
281
257
 
@@ -346,9 +322,6 @@ module Vedeu
346
322
  # @return [String|Symbol]
347
323
  def exit_key(value)
348
324
  return invalid_key('exit_key') unless valid_key?(value)
349
-
350
- Vedeu.log(type: :info, message: "Configuration::API exit_key: #{value}")
351
-
352
325
  system_keys[:exit] = value
353
326
  end
354
327
 
@@ -367,10 +340,7 @@ module Vedeu
367
340
  # @param value [String|Symbol]
368
341
  # @return [String|Symbol]
369
342
  def focus_next_key(value)
370
- return invalid_key('exit_key') unless valid_key?(value)
371
-
372
- Vedeu.log(type: :info, message: "Configuration::API focus_next: #{value}")
373
-
343
+ return invalid_key('focus_next_key') unless valid_key?(value)
374
344
  system_keys[:focus_next] = value
375
345
  end
376
346
 
@@ -389,10 +359,7 @@ module Vedeu
389
359
  # @param value [String|Symbol]
390
360
  # @return [String|Symbol]
391
361
  def focus_prev_key(value)
392
- return invalid_key('exit_key') unless valid_key?(value)
393
-
394
- Vedeu.log(type: :info, message: "Configuration::API focus_prev: #{value}")
395
-
362
+ return invalid_key('focus_prev_key') unless valid_key?(value)
396
363
  system_keys[:focus_prev] = value
397
364
  end
398
365
 
@@ -411,10 +378,7 @@ module Vedeu
411
378
  # @param value [String|Symbol]
412
379
  # @return [String|Symbol]
413
380
  def mode_switch_key(value)
414
- return invalid_key('exit_key') unless valid_key?(value)
415
-
416
- Vedeu.log(type: :info, message: "Configuration::API mode_switch: #{value}")
417
-
381
+ return invalid_key('mode_switch_key') unless valid_key?(value)
418
382
  system_keys[:mode_switch] = value
419
383
  end
420
384
 
@@ -40,55 +40,39 @@ module Vedeu
40
40
 
41
41
  opts.on('-i', '--interactive',
42
42
  'Run the application in interactive mode (default).') do
43
- Vedeu.log(type: :info, message: "Configuration::CLI interactive: true")
44
-
45
43
  options[:interactive] = true
46
44
  end
47
45
 
48
46
  opts.on('-I', '--noninteractive', '--standalone',
49
47
  'Run the application non-interactively; i.e. not requiring ' \
50
48
  'intervention from the user.') do
51
- Vedeu.log(type: :info, message: "Configuration::CLI interactive: false")
52
-
53
49
  options[:interactive] = false
54
50
  end
55
51
 
56
52
  opts.on('-1', '--run-once',
57
53
  'Run the application loop once.') do
58
- Vedeu.log(type: :info, message: "Configuration::CLI once: true")
59
-
60
54
  options[:once] = true
61
55
  end
62
56
 
63
57
  opts.on('-n', '--run-many',
64
58
  'Run the application loop continuously (default).') do
65
- Vedeu.log(type: :info, message: "Configuration::CLI once: false")
66
-
67
59
  options[:once] = false
68
60
  end
69
61
 
70
62
  opts.on('-c', '--cooked', 'Run application in cooked mode.') do
71
- Vedeu.log(type: :info, message: "Configuration::CLI terminal_mode: :cooked")
72
-
73
63
  options[:terminal_mode] = :cooked
74
64
  end
75
65
 
76
66
  opts.on('-r', '--raw', 'Run application in raw mode (default).') do
77
- Vedeu.log(type: :info, message: "Configuration::CLI terminal_mode: :raw")
78
-
79
67
  options[:terminal_mode] = :raw
80
68
  end
81
69
 
82
70
  opts.on('-d', '--debug', 'Run application with debugging on.') do
83
- Vedeu.log(type: :info, message: "Configuration::CLI debug: true")
84
-
85
71
  options[:debug] = true
86
72
  end
87
73
 
88
74
  opts.on('-D', '--trace', 'Run application with debugging on with ' \
89
75
  'method and event tracing (noisy!).') do
90
- Vedeu.log(type: :info, message: "Configuration::CLI trace: true")
91
-
92
76
  options[:debug] = true
93
77
  options[:trace] = true
94
78
  end
@@ -97,13 +81,9 @@ module Vedeu
97
81
  'Run application in either `8`, `16`, `256` or `16777216` ' \
98
82
  'colour mode.') do |colours|
99
83
  if [8, 16, 256, 16777216].include?(colours)
100
- Vedeu.log(type: :info, message: "Configuration::CLI colour_mode: #{colours}")
101
-
102
84
  options[:colour_mode] = colours
103
85
 
104
86
  else
105
- Vedeu.log(type: :info, message: "Configuration::CLI colour_mode: 8 (defaulted)")
106
-
107
87
  options[:colour_mode] = 8
108
88
 
109
89
  end
@@ -111,49 +91,39 @@ module Vedeu
111
91
 
112
92
  opts.on('-l', '--log [FILENAME]', String,
113
93
  'Specify the path for the log file.') do |filename|
114
- Vedeu.log(type: :info, message: "Configuration::CLI log: #{filename}")
115
-
116
94
  options[:log] = filename
117
95
  end
118
96
 
119
97
  opts.on('--drb', 'Run application with DRb on.') do
120
- Vedeu.log(type: :info, message: "Configuration::CLI drb: true")
121
-
122
98
  options[:drb] = true
123
99
  end
124
100
 
125
101
  opts.on('--drb-host', 'Set the hostname/IP for the DRb server.') do |hostname|
126
- Vedeu.log(type: :info, message: "Configuration::CLI drb_host: #{hostname}")
127
-
128
102
  #options[:drb] = true
129
103
  options[:drb_host] = hostname
130
104
  end
131
105
 
132
106
  opts.on('--drb-port', 'Set the port for the DRb server.') do |port|
133
- Vedeu.log(type: :info, message: "Configuration::CLI drb_port: #{port}")
134
-
135
- #options[:drb] = true
107
+ # options[:drb] = true
136
108
  options[:drb_port] = port
137
109
  end
138
110
 
139
111
  opts.on('--drb-height', 'Set the height for fake terminal of the DRb server.') do |height|
140
- Vedeu.log(type: :info, message: "Configuration::CLI drb_height: #{height}")
141
-
142
- #options[:drb] = true
112
+ # options[:drb] = true
143
113
  options[:drb_height] = height
144
114
  end
145
115
 
146
116
  opts.on('--drb-width', 'Set the width for fake terminal of the DRb server.') do |width|
147
- Vedeu.log(type: :info, message: "Configuration::CLI drb_width: #{width}")
148
-
149
- #options[:drb] = true
117
+ # options[:drb] = true
150
118
  options[:drb_width] = width
151
119
  end
152
120
  end
153
121
 
154
122
  parser.parse!(args)
155
123
 
156
- options
124
+ options.each do |option, value|
125
+ Vedeu.log(type: :config, message: "CLI #{option.to_s}: #{value.to_s}")
126
+ end
157
127
  end
158
128
 
159
129
  private
@@ -196,8 +196,6 @@ module Vedeu
196
196
  #
197
197
  # @return [Hash]
198
198
  def reset!
199
- # Vedeu::Log.logger.debug('Resetting configuration.')
200
-
201
199
  instance.reset!
202
200
  end
203
201
 
@@ -233,8 +231,6 @@ module Vedeu
233
231
  #
234
232
  # @return [Hash]
235
233
  def reset!
236
- # Vedeu::Log.logger.debug('Resetting configuration.')
237
-
238
234
  @options = defaults
239
235
  end
240
236
 
@@ -73,19 +73,13 @@ module Vedeu
73
73
  def restart
74
74
  return not_enabled unless drb?
75
75
 
76
- if drb_running?
77
- log('Restarting')
78
-
79
- stop
76
+ log('Not running') unless drb_running?
80
77
 
81
- start
78
+ log('Restarting')
82
79
 
83
- else
84
- log('Not running')
80
+ stop
85
81
 
86
- start
87
-
88
- end
82
+ start
89
83
  end
90
84
 
91
85
  # When called will stop the DRb server and attempt to terminate the client
@@ -39,12 +39,10 @@ module Vedeu
39
39
  #
40
40
  # @raise [InvalidSyntax] The required block was not given.
41
41
  # @return [Keymap]
42
+ # @todo Try to remember why we need to pre-create the keymap in the
43
+ # repository.
42
44
  def keymap(name, &block)
43
- # fail InvalidSyntax, 'block not given' unless block_given?
44
-
45
- # @todo Try to remember why we need to pre-create the keymap in the
46
- # repository.
47
- Vedeu::Keymap.new(name).store
45
+ Vedeu::Keymap.new({ name: name }).store
48
46
 
49
47
  Vedeu::Keymap.build({ name: name }, &block).store
50
48
  end
@@ -15,51 +15,18 @@ module Vedeu
15
15
 
16
16
  attr_accessor :name
17
17
 
18
- class << self
19
-
20
- # @param attributes [Hash]
21
- # @param block [Proc]
22
- # @option attributes client []
23
- # @option attributes keys []
24
- # @option attributes name [String]
25
- # @option attributes repository [Vedeu::Repository]
26
- # @raise [InvalidSyntax] The required block was not given.
27
- # @return [Vedeu::Keymap]
28
- def build(attributes = {}, &block)
29
- fail InvalidSyntax, 'block not given' unless block_given?
30
-
31
- attributes = defaults.merge(attributes)
32
-
33
- model = new(attributes[:name],
34
- attributes[:keys],
35
- attributes[:repository])
36
- model.deputy(attributes[:client]).instance_eval(&block)
37
- model.store
38
- end
39
-
40
- private
41
-
42
- # The default values for a new instance of this class.
43
- #
44
- # @return [Hash]
45
- def defaults
46
- {
47
- client: nil,
48
- keys: [],
49
- name: '',
50
- repository: Vedeu::Keymaps.keymaps,
51
- }
52
- end
53
-
54
- end
55
-
56
- # @param name [String] The name of the keymap.
57
- # @param keys [Vedeu::Model::Collection|Array] A collection of keys.
18
+ # @param attributes [Hash]
19
+ # @option attributes name [String] The name of the keymap.
20
+ # @option attributes keys [Vedeu::Model::Collection|Array] A collection of
21
+ # keys.
22
+ # @option attributes repository [Vedeu::Repository] This model's storage.
58
23
  # @return [Vedeu::Keymap]
59
- def initialize(name = '', keys = [], repository = nil)
60
- @name = name
61
- @keys = keys
62
- @repository = repository || Vedeu::Keymaps.keymaps
24
+ def initialize(attributes = {})
25
+ @attributes = defaults.merge(attributes)
26
+
27
+ @name = @attributes[:name]
28
+ @keys = @attributes[:keys]
29
+ @repository = @attributes[:repository]
63
30
  end
64
31
 
65
32
  # @param key [Key]
@@ -99,6 +66,15 @@ module Vedeu
99
66
 
100
67
  private
101
68
 
69
+ # @return [Hash]
70
+ def defaults
71
+ {
72
+ name: '',
73
+ keys: [],
74
+ repository: Vedeu::Keymaps.keymaps,
75
+ }
76
+ end
77
+
102
78
  # Checks that the provided key is not already registered with this keymap.
103
79
  #
104
80
  # @param key [Vedeu::Key]
@@ -106,7 +82,8 @@ module Vedeu
106
82
  def valid?(key)
107
83
  return true unless key_defined?(key.input)
108
84
 
109
- Vedeu.log(type: :debug, message: "Keymap '#{name}' already defines '#{key.input}'.")
85
+ Vedeu.log(type: :debug,
86
+ message: "Keymap '#{name}' already defines '#{key.input}'.")
110
87
 
111
88
  false
112
89
  end
@@ -34,6 +34,8 @@ module Vedeu
34
34
  @loop = false
35
35
  end
36
36
 
37
+ private
38
+
37
39
  # Check the application has started and we wish to continue running.
38
40
  #
39
41
  # @raise [VedeuInterrupt] When we wish to terminate the running application.
@@ -102,7 +102,7 @@ module Vedeu
102
102
  #
103
103
  # @return [Array]
104
104
  def refresh
105
- Vedeu.trigger("_refresh_#{current}_".to_sym)
105
+ Vedeu.trigger(:_refresh_, current)
106
106
  end
107
107
 
108
108
  # Returns a collection of the names of all the registered entities.
@@ -261,6 +261,8 @@ module Vedeu
261
261
  right + value
262
262
  end
263
263
 
264
+ private
265
+
264
266
  # Provides a virtual y position within the interface's dimensions.
265
267
  #
266
268
  # @example
@@ -285,8 +287,6 @@ module Vedeu
285
287
  (left...right).to_a
286
288
  end
287
289
 
288
- private
289
-
290
290
  # The default values for a new instance of this class.
291
291
  #
292
292
  # @return [Hash]
@@ -1,5 +1,5 @@
1
1
  require 'vedeu/output/html_char'
2
- require 'vedeu/presentation/presentation'
2
+ require 'vedeu/output/presentation'
3
3
 
4
4
  module Vedeu
5
5
 
@@ -1,6 +1,6 @@
1
1
  require 'vedeu/dsl/composition'
2
2
  require 'vedeu/models/collection'
3
- require 'vedeu/presentation/presentation'
3
+ require 'vedeu/output/presentation'
4
4
  require 'vedeu/support/common'
5
5
 
6
6
  require 'vedeu/models/view/interfaces'
@@ -1,6 +1,6 @@
1
1
  require 'vedeu/support/content_geometry'
2
2
  require 'vedeu/models/model'
3
- require 'vedeu/presentation/presentation'
3
+ require 'vedeu/output/presentation'
4
4
  require 'vedeu/buffers/display_buffer'
5
5
  require 'vedeu/buffers/buffer'
6
6
 
@@ -108,6 +108,9 @@ module Vedeu
108
108
  end
109
109
  end
110
110
 
111
+ # Fetch the cursor belonging to this interface (by name), if one does not
112
+ # exist, it will be created, stored and returned.
113
+ #
111
114
  # @return [Vedeu::Cursor]
112
115
  def cursor
113
116
  Vedeu.cursors.by_name(name)
@@ -144,7 +147,6 @@ module Vedeu
144
147
  super
145
148
 
146
149
  store_new_buffer
147
- store_refresh_events
148
150
  store_focusable
149
151
  store_cursor
150
152
  store_group
@@ -1,5 +1,4 @@
1
- require 'vedeu/presentation/presentation'
2
-
1
+ require 'vedeu/output/presentation'
3
2
  require 'vedeu/models/view/streams'
4
3
  require 'vedeu/models/view/stream'
5
4
 
@@ -1,4 +1,4 @@
1
- require 'vedeu/presentation/presentation'
1
+ require 'vedeu/output/presentation'
2
2
  require 'vedeu/models/view/char'
3
3
 
4
4
  module Vedeu
@@ -1,5 +1,13 @@
1
+ require 'vedeu/output/translator'
2
+ require 'vedeu/output/background'
3
+ require 'vedeu/output/foreground'
4
+
1
5
  require 'vedeu/output/border'
6
+ require 'vedeu/output/colour'
2
7
  require 'vedeu/output/compositor'
8
+
9
+ require 'vedeu/output/presentation'
10
+ require 'vedeu/output/style'
3
11
  require 'vedeu/output/position_index'
4
12
  require 'vedeu/output/virtual_buffer'
5
13
  require 'vedeu/output/html_char'
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  require 'vedeu/configuration/configuration'
2
- require 'vedeu/presentation/translator'
2
+ require 'vedeu/output/translator'
3
3
  require 'vedeu/support/esc'
4
4
 
5
5
  module Vedeu