vedeu 0.4.25 → 0.4.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu.rb +0 -5
  3. data/lib/vedeu/output/border.rb +11 -10
  4. data/lib/vedeu/output/presentation.rb +10 -10
  5. data/lib/vedeu/repositories/registerable.rb +12 -0
  6. data/lib/vedeu/repositories/repositories/borders.rb +1 -4
  7. data/lib/vedeu/repositories/repositories/buffers.rb +1 -4
  8. data/lib/vedeu/repositories/repositories/cursors.rb +1 -4
  9. data/lib/vedeu/repositories/repositories/events_repository.rb +1 -4
  10. data/lib/vedeu/repositories/repositories/geometries.rb +1 -4
  11. data/lib/vedeu/repositories/repositories/groups.rb +1 -4
  12. data/lib/vedeu/repositories/repositories/interfaces_repository.rb +1 -4
  13. data/lib/vedeu/repositories/repositories/keymaps.rb +1 -4
  14. data/lib/vedeu/repositories/repositories/menus.rb +1 -4
  15. data/lib/vedeu/support/all.rb +0 -1
  16. data/test/lib/vedeu/api_test.rb +11 -11
  17. data/test/lib/vedeu/repositories/repositories/borders_test.rb +0 -6
  18. data/test/lib/vedeu/repositories/repositories/buffers_test.rb +0 -6
  19. data/test/lib/vedeu/repositories/repositories/cursors_test.rb +0 -6
  20. data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +0 -6
  21. data/test/lib/vedeu/repositories/repositories/geometries_test.rb +0 -6
  22. data/test/lib/vedeu/repositories/repositories/groups_test.rb +0 -6
  23. data/test/lib/vedeu/repositories/repositories/interfaces_repositories_test.rb +0 -6
  24. data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +0 -6
  25. data/test/lib/vedeu/repositories/repositories/menus_test.rb +0 -6
  26. data/test/test_helper.rb +0 -4
  27. data/vedeu.gemspec +1 -1
  28. metadata +2 -5
  29. data/lib/vedeu/support/trace.rb +0 -197
  30. data/test/lib/vedeu/support/trace_test.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb6dc29e78bc70eab80c780ef16626cddbdcdf0b
4
- data.tar.gz: e83efc8abd484c8436ae562fd393bfb745706475
3
+ metadata.gz: 2bba3e9391ad8c7f14484b09adc03826c64cdff5
4
+ data.tar.gz: 166ea2c63e70165ec7a7b33902e8946d7f14c3b5
5
5
  SHA512:
6
- metadata.gz: fe72d64a341a1447e93f85ffcc7213d3e598ad682ab912689be1c3a0b825c82c9dcaa4402513a9b738f0f9b43b18257d8d161ef384573248588c1690a40d2e4f
7
- data.tar.gz: 183b719c6624c17c606fc29a3d163cd2b6ded9138a9943c032292f50a0155c8c47abc2474cfcd0da284a506c0830d48761cbcf18e679808b9daae2aaa17458db
6
+ metadata.gz: b18d838e63f6d47ed70ad102e5db5157bbebebbf34faf0acdcc7cbdc34cfbf13348ee2d24cb3e765d478d1f7076290c5053c1092f60d1087bf8093c97d42b603
7
+ data.tar.gz: c10f07257a95dde84f961448fe4ba6d07a2539235258be5163792eeb1c345af2052786d2e006a1dd54f3452cf931aa10faf037e9fd559ef7073803186e98c393
data/lib/vedeu.rb CHANGED
@@ -81,8 +81,3 @@ module Vedeu
81
81
  end # Vedeu
82
82
 
83
83
  require 'vedeu/all'
84
-
85
- require 'vedeu/support/trace'
86
- Vedeu::Trace.call
87
- # force tracing
88
- # Vedeu::Trace.call({ trace: true })
@@ -361,16 +361,17 @@ module Vedeu
361
361
  # @param ix [Fixnum]
362
362
  # @return [Vedeu::Position]
363
363
  def position(name, iy = 0, ix = 0)
364
- case name
365
- when :top_horizontal then Vedeu::Position.coerce([y, (bx + ix)])
366
- when :bottom_horizontal then Vedeu::Position.coerce([yn, (bx + ix)])
367
- when :left_vertical then Vedeu::Position.coerce([(by + iy), x])
368
- when :right_vertical then Vedeu::Position.coerce([(by + iy), xn])
369
- when :bottom_left then Vedeu::Position.coerce([yn, x])
370
- when :bottom_right then Vedeu::Position.coerce([yn, xn])
371
- when :top_left then Vedeu::Position.coerce([y, x])
372
- when :top_right then Vedeu::Position.coerce([y, xn])
373
- end
364
+ coords = case name
365
+ when :top_horizontal then [y, (bx + ix)]
366
+ when :bottom_horizontal then [yn, (bx + ix)]
367
+ when :left_vertical then [(by + iy), x]
368
+ when :right_vertical then [(by + iy), xn]
369
+ when :bottom_left then [yn, x]
370
+ when :bottom_right then [yn, xn]
371
+ when :top_left then [y, x]
372
+ when :top_right then [y, xn]
373
+ end
374
+ Vedeu::Position.coerce(coords)
374
375
  end
375
376
 
376
377
  end # Border
@@ -8,13 +8,13 @@ module Vedeu
8
8
  # @return [Vedeu::Background]
9
9
  def background
10
10
  @background ||= if colour
11
- colour.background
11
+ colour.background
12
12
 
13
- else
14
- Vedeu::Background.new
15
- # @todo: Should this be: parent_background
13
+ else
14
+ Vedeu::Background.new
15
+ # @todo: Should this be: parent_background
16
16
 
17
- end
17
+ end
18
18
  end
19
19
 
20
20
  # @return [Vedeu::Background]
@@ -37,13 +37,13 @@ module Vedeu
37
37
  # @return [Vedeu::Foreground]
38
38
  def foreground
39
39
  @foreground ||= if colour
40
- colour.foreground
40
+ colour.foreground
41
41
 
42
- else
43
- Vedeu::Foreground.new
44
- # @todo: Should this be: parent_foreground
42
+ else
43
+ Vedeu::Foreground.new
44
+ # @todo: Should this be: parent_foreground
45
45
 
46
- end
46
+ end
47
47
  end
48
48
 
49
49
  # @return [Vedeu::Foreground]
@@ -34,6 +34,18 @@ module Vedeu
34
34
  end
35
35
  end
36
36
 
37
+ # Returns the repositories registered.
38
+ #
39
+ # @note
40
+ # If the repository is 'Geometries', for example, then @models will be
41
+ # either an empty Geometries repository or the collection of stored
42
+ # models.
43
+ #
44
+ # @return [void]
45
+ def repository
46
+ @models ||= reset!
47
+ end
48
+
37
49
  end # ClassMethods
38
50
 
39
51
  # When this module is included in a class, provide ClassMethods as class
@@ -7,10 +7,7 @@ module Vedeu
7
7
  class << self
8
8
 
9
9
  # @return [Vedeu::Borders]
10
- def borders
11
- @borders ||= reset!
12
- end
13
- alias_method :repository, :borders
10
+ alias_method :borders, :repository
14
11
 
15
12
  # Remove all stored models from the repository.
16
13
  #
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::Buffers]
9
- def buffers
10
- @buffers ||= reset!
11
- end
12
- alias_method :repository, :buffers
9
+ alias_method :buffers, :repository
13
10
 
14
11
  # Remove all stored models from the repository.
15
12
  #
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::Cursors]
9
- def cursors
10
- @cursors ||= reset!
11
- end
12
- alias_method :repository, :cursors
9
+ alias_method :cursors, :repository
13
10
 
14
11
  # @return [Vedeu::Cursor]
15
12
  def cursor
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::EventsRepository]
9
- def events
10
- @events ||= reset!
11
- end
12
- alias_method :repository, :events
9
+ alias_method :events, :repository
13
10
 
14
11
  # Remove all stored models from the repository.
15
12
  #
@@ -7,10 +7,7 @@ module Vedeu
7
7
  class << self
8
8
 
9
9
  # @return [Vedeu::Geometries]
10
- def geometries
11
- @geometries ||= reset!
12
- end
13
- alias_method :repository, :geometries
10
+ alias_method :geometries, :repository
14
11
 
15
12
  # Remove all stored models from the repository.
16
13
  #
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::Groups]
9
- def groups
10
- @groups ||= reset!
11
- end
12
- alias_method :repository, :groups
9
+ alias_method :groups, :repository
13
10
 
14
11
  # Remove all stored models from the repository.
15
12
  #
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::InterfacesRepository]
9
- def interfaces
10
- @interfaces ||= reset!
11
- end
12
- alias_method :repository, :interfaces
9
+ alias_method :interfaces, :repository
13
10
 
14
11
  # Remove all stored models from the repository.
15
12
  #
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::Keymaps]
9
- def keymaps
10
- @keymaps ||= reset!
11
- end
12
- alias_method :repository, :keymaps
9
+ alias_method :keymaps, :repository
13
10
 
14
11
  # Remove all stored models from the repository.
15
12
  #
@@ -6,10 +6,7 @@ module Vedeu
6
6
  class << self
7
7
 
8
8
  # @return [Vedeu::Menus]
9
- def menus
10
- @menus ||= reset!
11
- end
12
- alias_method :repository, :menus
9
+ alias_method :menus, :repository
13
10
 
14
11
  # Remove all stored models from the repository.
15
12
  #
@@ -3,5 +3,4 @@ require_relative 'options'
3
3
  require_relative 'template'
4
4
  require_relative 'terminal'
5
5
  require_relative 'timer'
6
- require_relative 'trace'
7
6
  require_relative 'visibility'
@@ -18,7 +18,7 @@ module Vedeu
18
18
  describe '.borders' do
19
19
  subject { Vedeu.borders }
20
20
 
21
- # it { subject.must_be_instance_of(Vedeu::Borders) }
21
+ it { subject.must_be_instance_of(Vedeu::Borders) }
22
22
  end
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ module Vedeu
26
26
  describe '.buffers' do
27
27
  subject { Vedeu.buffers }
28
28
 
29
- # it { subject.must_be_instance_of(Vedeu::Buffers) }
29
+ it { subject.must_be_instance_of(Vedeu::Buffers) }
30
30
  end
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ module Vedeu
34
34
  describe '.canvas' do
35
35
  subject { Vedeu.canvas }
36
36
 
37
- # it { subject.must_be_instance_of(Vedeu::Canvas) }
37
+ it { subject.must_be_instance_of(Vedeu::Canvas) }
38
38
  end
39
39
  end
40
40
 
@@ -48,7 +48,7 @@ module Vedeu
48
48
  describe '.configuration' do
49
49
  subject { Vedeu.configuration }
50
50
 
51
- # it { subject.must_be_instance_of(Vedeu::Configuration) }
51
+ it { subject.must_be_instance_of(Vedeu::Configuration) }
52
52
  end
53
53
  end
54
54
 
@@ -66,7 +66,7 @@ module Vedeu
66
66
  describe '.cursors' do
67
67
  subject { Vedeu.cursors }
68
68
 
69
- # it { subject.must_be_instance_of(Vedeu::Cursors) }
69
+ it { subject.must_be_instance_of(Vedeu::Cursors) }
70
70
  end
71
71
  end
72
72
 
@@ -152,7 +152,7 @@ module Vedeu
152
152
  describe '.events' do
153
153
  subject { Vedeu.events }
154
154
 
155
- # it { subject.must_be_instance_of(Vedeu::EventsRepository) }
155
+ it { subject.must_be_instance_of(Vedeu::EventsRepository) }
156
156
  end
157
157
  end
158
158
 
@@ -204,7 +204,7 @@ module Vedeu
204
204
  describe '.geometries' do
205
205
  subject { Vedeu.geometries }
206
206
 
207
- # it { subject.must_be_instance_of(Vedeu::Geometries) }
207
+ it { subject.must_be_instance_of(Vedeu::Geometries) }
208
208
  end
209
209
  end
210
210
 
@@ -212,7 +212,7 @@ module Vedeu
212
212
  describe '.groups' do
213
213
  subject { Vedeu.groups }
214
214
 
215
- # it { subject.must_be_instance_of(Vedeu::Groups) }
215
+ it { subject.must_be_instance_of(Vedeu::Groups) }
216
216
  end
217
217
  end
218
218
 
@@ -220,7 +220,7 @@ module Vedeu
220
220
  describe '.interfaces' do
221
221
  subject { Vedeu.interfaces }
222
222
 
223
- # it { subject.must_be_instance_of(Vedeu::InterfacesRepository) }
223
+ it { subject.must_be_instance_of(Vedeu::InterfacesRepository) }
224
224
  end
225
225
  end
226
226
 
@@ -228,7 +228,7 @@ module Vedeu
228
228
  describe '.keymaps' do
229
229
  subject { Vedeu.keymaps }
230
230
 
231
- # it { subject.must_be_instance_of(Vedeu::Keymaps) }
231
+ it { subject.must_be_instance_of(Vedeu::Keymaps) }
232
232
  end
233
233
  end
234
234
 
@@ -260,7 +260,7 @@ module Vedeu
260
260
  describe '.menus' do
261
261
  subject { Vedeu.menus }
262
262
 
263
- # it { subject.must_be_instance_of(Vedeu::Menus) }
263
+ it { subject.must_be_instance_of(Vedeu::Menus) }
264
264
  end
265
265
  end
266
266
 
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Borders }
8
8
 
9
- describe '.borders' do
10
- subject { described.borders }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  describe '#by_name' do
16
10
  let(:_name) { 'carbon' }
17
11
 
@@ -7,12 +7,6 @@ module Vedeu
7
7
  let(:described) { Vedeu::Buffers }
8
8
  let(:instance) { described.buffers }
9
9
 
10
- describe '.buffers' do
11
- subject { instance }
12
-
13
- it { subject.must_be_instance_of(described) }
14
- end
15
-
16
10
  describe '#by_name' do
17
11
  let(:_name) { 'carbon' }
18
12
 
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Cursors }
8
8
 
9
- describe '.cursors' do
10
- subject { described.cursors }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  describe '.cursor' do
16
10
  subject { Vedeu.cursor }
17
11
 
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::EventsRepository }
8
8
 
9
- describe '.events' do
10
- subject { described.events }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  end # EventsRepository
16
10
 
17
11
  end # Vedeu
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Geometries }
8
8
 
9
- describe '.geometries' do
10
- subject { described.geometries }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  describe '#by_name' do
16
10
  let(:_name) { 'carbon' }
17
11
 
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Groups }
8
8
 
9
- describe '.groups' do
10
- subject { described.groups }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  describe '#by_name' do
16
10
  let(:_name) { 'carbon' }
17
11
 
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::InterfacesRepository }
8
8
 
9
- describe '.interfaces' do
10
- subject { described.interfaces }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  end # InterfacesRepository
16
10
 
17
11
  end # Vedeu
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Keymaps }
8
8
 
9
- describe '.keymaps' do
10
- subject { described.keymaps }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  end # Keymaps
16
10
 
17
11
  end # Vedeu
@@ -6,12 +6,6 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Menus }
8
8
 
9
- describe '.menus' do
10
- subject { described.menus }
11
-
12
- it { subject.must_be_instance_of(described) }
13
- end
14
-
15
9
  end # Menus
16
10
 
17
11
  end # Vedeu
data/test/test_helper.rb CHANGED
@@ -47,10 +47,6 @@ require 'support/helpers/model_test_class'
47
47
  # # Minitest::Reporters::SpecReporter.new
48
48
  # )
49
49
 
50
- # trace method execution with (optionally) local variables
51
- # require 'vedeu/support/log'
52
- # Vedeu::Trace.call({ watched: 'call', klass: /^Vedeu/ })
53
-
54
50
  def test_configuration
55
51
  Vedeu::Configuration.reset!
56
52
 
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.4.25'
7
+ spec.version = '0.4.26'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = 'A terminal case of wonderland.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.25
4
+ version: 0.4.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-06 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -431,7 +431,6 @@ files:
431
431
  - lib/vedeu/support/template.rb
432
432
  - lib/vedeu/support/terminal.rb
433
433
  - lib/vedeu/support/timer.rb
434
- - lib/vedeu/support/trace.rb
435
434
  - lib/vedeu/support/visibility.rb
436
435
  - lib/vedeu/traps.rb
437
436
  - logs/.gitkeep
@@ -550,7 +549,6 @@ files:
550
549
  - test/lib/vedeu/support/options_test.rb
551
550
  - test/lib/vedeu/support/template_test.rb
552
551
  - test/lib/vedeu/support/terminal_test.rb
553
- - test/lib/vedeu/support/trace_test.rb
554
552
  - test/lib/vedeu/support/visibility_test.rb
555
553
  - test/lib/vedeu/traps_test.rb
556
554
  - test/lib/vedeu_test.rb
@@ -701,7 +699,6 @@ test_files:
701
699
  - test/lib/vedeu/support/options_test.rb
702
700
  - test/lib/vedeu/support/template_test.rb
703
701
  - test/lib/vedeu/support/terminal_test.rb
704
- - test/lib/vedeu/support/trace_test.rb
705
702
  - test/lib/vedeu/support/visibility_test.rb
706
703
  - test/lib/vedeu/traps_test.rb
707
704
  - test/lib/vedeu_test.rb
@@ -1,197 +0,0 @@
1
- module Vedeu
2
-
3
- # :nocov:
4
- # This class currently provides the means to trace each method call which
5
- # occurs inside Vedeu. This is very useful (to me!) for debugging. Running
6
- # this will make your application less responsive, and the tests
7
- # excruciatingly slow to run.
8
- class Trace
9
-
10
- # @todo
11
- # Replace this class with this:
12
- #
13
- # def self.trace
14
- # trace = TracePoint.new(:call) do |tp|
15
- # if tp.defined_class.to_s.match(/Troo/)
16
- # Vedeu.log(type: :debug,
17
- # message: [tp.defined_class.to_s,
18
- # tp.method_id.to_s].join(' '))
19
- # end
20
- # end
21
- # trace.enable
22
- # end
23
-
24
- # @param options [Hash]
25
- # @option option event [Symbol]
26
- # @option option trace [Boolean]
27
- # @return [void]
28
- def self.call(options = {})
29
- new(options).trace
30
- end
31
-
32
- # Returns a new instance of Vedeu::Trace
33
- #
34
- # @param options [Hash]
35
- # @return [Trace]
36
- def initialize(options = {})
37
- @options = options
38
- end
39
-
40
- # Performs the trace operation. Building strings which include:
41
- # - (class_count) a count of classes registered with Vedeu,
42
- # - (classname) the class name being traced,
43
- # - (id) the method name being traced,
44
- # - (vars) any local variables belonging to the method.
45
- #
46
- # @note
47
- # Arguments to set_trace_func proc:
48
- # |event, file, line, id, binding, name|
49
- #
50
- # @todo Deprecate, and use TracePoint instead.
51
- #
52
- # @return [NilClass|String]
53
- def trace
54
- set_trace_func proc { |event, _, _, id, binding, name|
55
- if event == watched && id != :log && classes.include?(name.to_s)
56
- vars = variables(binding)
57
-
58
- if vars.empty?
59
- log_this(format('%s %-25s #%-20s', count, name, id))
60
-
61
- else
62
- log_this(format("%s %-25s #%-20s\n%s\n", count, name, id, vars))
63
-
64
- end
65
- end
66
- } if trace?
67
- end
68
-
69
- private
70
-
71
- # Writes the message to the log file.
72
- #
73
- # @param message [String]
74
- # @return [String]
75
- def log_this(message)
76
- Vedeu::Log.logger.debug(message)
77
-
78
- message
79
- end
80
-
81
- # Provides inspection of the local variables set within the method being
82
- # traced. Makes the log file extremely noisy, but very useful for hunting
83
- # down bugs.
84
- #
85
- # @param binding [Class]
86
- # @return [String]
87
- def variables(binding)
88
- binding.eval('local_variables').each do |var|
89
- variable = Vedeu::Esc.green { var.to_s }
90
- value = binding.local_variable_get(var)
91
- klass = Vedeu::Esc.magenta { value.class.to_s }
92
- output = (value.is_a?(Proc)) ? '#<Proc:...' : value.inspect
93
- content = colour(value.class.to_s, output)
94
-
95
- format('%33s %-10s = %s %s', ' ', variable, klass, content)
96
- end.join("\n")
97
- end
98
-
99
- # @return [String]
100
- def watched
101
- options[:event]
102
- end
103
-
104
- # @return [Boolean]
105
- def trace?
106
- options[:trace]
107
- end
108
-
109
- # @return [Hash]
110
- def options
111
- defaults.merge!(@options)
112
- end
113
-
114
- # The default values for a new instance of this class.
115
- #
116
- # @return [Hash]
117
- def defaults
118
- {
119
- trace: Vedeu::Configuration.trace?,
120
- event: 'call',
121
- }
122
- end
123
-
124
- # @return [Hash]
125
- def colour(klass, output)
126
- {
127
- 'Array' => :yellow,
128
- 'Fixnum' => :cyan,
129
- 'Hash' => :blue,
130
- 'NilClass' => :red,
131
- 'String' => :green,
132
- 'Symbol' => :magenta,
133
- }.fetch(klass, :white) { |colour| Vedeu::Esc.send(colour) { output } }
134
- end
135
-
136
- # Returns the number of Vedeu classes/modules. (Useful for debugging.)
137
- #
138
- # @return [String]
139
- def count
140
- @count ||= "(#{classes.size}/#{vedeu_classes.size})"
141
- end
142
-
143
- # Returns the classes to be traced, without exceptions or ignored classes.
144
- #
145
- # @return [Set]
146
- def classes
147
- @classes ||= vedeu_classes - vedeu_exceptions - ignored_classes
148
- end
149
-
150
- # Returns all the classes defined within Vedeu.
151
- #
152
- # @return [Set]
153
- def vedeu_classes
154
- @vedeu_classes ||= Vedeu.constants.collect do |c|
155
- Vedeu.const_get(c).to_s
156
- end.to_set
157
- end
158
-
159
- # Returns all the exceptions defined within Vedeu.
160
- #
161
- # @todo Vedeu should produce this set.
162
- #
163
- # @return [Set]
164
- def vedeu_exceptions
165
- Vedeu::EXCEPTIONS.to_set
166
- end
167
-
168
- # Returns a set of classes to ignore during tracing.
169
- #
170
- # @todo Make this configurable at runtime.
171
- #
172
- # @return [Set]
173
- def ignored_classes
174
- Set.new [
175
- 'Vedeu::Coercions',
176
- 'Vedeu::Colour',
177
- 'Vedeu::Common',
178
- 'Vedeu::Configuration',
179
- 'Vedeu::Esc',
180
- 'Vedeu::Event',
181
- 'Vedeu::Geometry',
182
- 'Vedeu::Log',
183
- 'Vedeu::Position',
184
- 'Vedeu::Presentation',
185
- 'Vedeu::Repository',
186
- 'Vedeu::Stream',
187
- 'Vedeu::Style',
188
- 'Vedeu::Terminal',
189
- 'Vedeu::Trace',
190
- 'Vedeu::Translator',
191
- ]
192
- end
193
-
194
- end # Trace
195
- # :nocov:
196
-
197
- end # Vedeu
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe Trace do
6
-
7
- let(:described) { Vedeu::Trace }
8
- let(:instance) { described.new(options) }
9
- let(:options) { {} }
10
-
11
- describe '#initialize' do
12
- it { instance.must_be_instance_of(described) }
13
- it { instance.instance_variable_get('@options').must_equal(options) }
14
- end
15
-
16
- describe '.call' do
17
- subject { described.call(options) }
18
-
19
- context 'when trace is enabled in the configuration' do
20
- end
21
-
22
- context 'when trace is disabled in the configuration' do
23
- context 'and not enabled via the options' do
24
-
25
- end
26
- context 'but enabled via the options' do
27
- let(:options) { { trace: true } }
28
-
29
- end
30
- end
31
- end
32
-
33
- end # Trace
34
-
35
- end # Vedeu