vedeu 0.8.30 → 0.8.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d413edf12c3450b500f123c44d7eaef2bd512cd3
4
- data.tar.gz: f3b2c6fa3ea87716b5fd1c39dc751dc6bbbe1fea
3
+ metadata.gz: 54d020b1ed4da7b4cf81758fa09f9dfc06112407
4
+ data.tar.gz: a09b4f6ac797e2948d01816492dd384fc61c88c3
5
5
  SHA512:
6
- metadata.gz: 1516ca7c31dc09a7e3dbed8698257db558d59085badcc1006babf39ed52cbf1c57018d514a81049dabc9db673e3d5d144826d0c7ce2c3cf23d4216756ea0b10c
7
- data.tar.gz: edd78dd5bf4664a07d71a96a322c2dfeb2e495522c26dc0a19ebd16cb277ad986dbd3f7707ced8b8ce0539874cda058bd7dff82c3524032a5cb8177f072203b4
6
+ metadata.gz: fd78a43accb8571c469797daeb2f3fd753c11540612a7001e5a67d65066d6b9b55edd97ad943b67e04e4557c39a0d9e3a6d0ffc5b7c1bb7f7f9fc9c0d53d3082
7
+ data.tar.gz: 048c82e69c2fd6ae30a142da63ad24109d5a0ad444ef4aa9dc94e389786e62255928117f34eb2a25e5337f8d3bbc131b8edd472da1496e1cdde7215e19288578
data/.rubocop.yml CHANGED
@@ -1,6 +1,3 @@
1
- inherit_from:
2
- - config/rubocop_enabled.yml
3
-
4
1
  AllCops:
5
2
  Include:
6
3
  - '**/*.gemspec'
@@ -29,9 +26,22 @@ AllCops:
29
26
  StyleGuideCopsOnly: false
30
27
  TargetRubyVersion: 2.3
31
28
 
29
+ Lint/Eval:
30
+ Description: 'The use of eval represents a serious security risk.'
31
+ Enabled: false
32
+
32
33
  Lint/UnusedMethodArgument:
33
34
  Enabled: false
34
35
 
36
+ Style/AsciiComments:
37
+ Description: 'Use only ascii symbols in comments.'
38
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
39
+ Enabled: false
40
+
41
+ Style/Documentation:
42
+ Description: 'Document classes and non-namespace modules.'
43
+ Enabled: false
44
+
35
45
  Style/EmptyLinesAroundBlockBody:
36
46
  EnforcedStyle: no_empty_lines
37
47
 
@@ -41,61 +51,18 @@ Style/EmptyLinesAroundClassBody:
41
51
  Style/EmptyLinesAroundModuleBody:
42
52
  EnforcedStyle: empty_lines
43
53
 
44
- Style/ExtraSpacing:
45
- Enabled: false
46
-
47
- # Style/GlobalVars:
48
- # AllowedVariables: [$LIB_DIR]
49
-
50
- # Style/GuardClause:
51
- # MinBodyLength: 1
52
-
53
- # Style/IfUnlessModifier:
54
- # MaxLineLength: 80
55
-
56
- # Style/IndentationWidth:
57
- # Width: 2
58
-
59
- # Style/IndentHash:
60
- # EnforcedStyle: special_inside_parentheses
61
- # SupportedStyles:
62
- # - special_inside_parentheses
63
- # - consistent
64
-
65
54
  Style/MultilineBlockChain:
66
55
  Enabled: false
67
56
 
68
- Style/MultilineOperationIndentation:
69
- Enabled: false
70
-
71
57
  Style/ModuleFunction:
72
58
  Enabled: false
73
59
 
74
- # Style/Next:
75
- # EnforcedStyle: skip_modifier_ifs
76
- # MinBodyLength: 3
77
- # SupportedStyles:
78
- # - skip_modifier_ifs
79
- # - always
80
-
81
60
  Style/RescueModifier:
82
61
  Enabled: false
83
62
 
84
63
  Style/SpaceAroundOperators:
85
64
  Enabled: false
86
65
 
87
- # Style/SpaceAroundEqualsInParameterDefault:
88
- # EnforcedStyle: space
89
-
90
- # Style/SpaceBeforeBlockBraces:
91
- # EnforcedStyle: space
92
-
93
- # Style/SpaceInsideBlockBraces:
94
- # EnforcedStyle: space
95
-
96
- # Style/SpaceInsideHashLiteralBraces:
97
- # EnforcedStyle: space
98
-
99
66
  Style/TrailingBlankLines:
100
67
  EnforcedStyle: final_newline
101
68
 
@@ -105,8 +72,9 @@ Style/TrailingCommaInLiteral:
105
72
  Metrics/AbcSize:
106
73
  Max: 25
107
74
 
108
- # Metrics/BlockNesting:
109
- # Max: 3
75
+ Metrics/ClassLength:
76
+ Description: 'Avoid classes longer than 100 lines of code.'
77
+ Enabled: false
110
78
 
111
79
  Metrics/CyclomaticComplexity:
112
80
  Max: 12
@@ -5,7 +5,11 @@ templates and other resources). By default the base path is
5
5
  just the current working directory but this will not work for many
6
6
  applications.
7
7
 
8
+ # Set:
8
9
  Vedeu.configure do
9
10
  base_path '/path/to/application'
10
11
  # ...
11
12
  end
13
+
14
+ # Get:
15
+ Vedeu.config.base_path
@@ -1,6 +1,10 @@
1
1
  Sets the background and foreground of the terminal.
2
2
 
3
+ # Set:
3
4
  Vedeu.configure do
4
5
  colour background: '#ff0000', foreground: '#ffff00'
5
6
  # ...
6
7
  end
8
+
9
+ # Get:
10
+ Vedeu.config.colour
@@ -1,10 +1,14 @@
1
1
  Sets the colour mode of the terminal.
2
2
 
3
+ # Set:
3
4
  Vedeu.configure do
4
5
  colour_mode 256
5
6
  # ...
6
7
  end
7
8
 
9
+ # Get:
10
+ Vedeu.config.colour_mode
11
+
8
12
  Note
9
13
  - iTerm 2 on Mac OSX will handle the true colour setting
10
14
  (16777216), whereas Terminator on Linux will not display
@@ -6,6 +6,7 @@ Sets boolean to enable/disable compression. Vedeu's default setting is
6
6
  for compression to be enabled. Setting `compression` to false will
7
7
  disable compression.
8
8
 
9
+ # Set:
9
10
  Vedeu.configure do
10
11
  compression! # enabled (default)
11
12
  # ...
@@ -16,6 +17,9 @@ disable compression.
16
17
  # ...
17
18
  end
18
19
 
20
+ # Get:
21
+ Vedeu.config.compression
22
+
19
23
  Note:
20
24
 
21
25
  - Be aware that running an application without compression will affect
@@ -1,7 +1,11 @@
1
1
  Sets the terminal mode to `cooked`. Default terminal mode is `raw`.
2
2
  Also, see {Vedeu::Config::API#raw!}
3
3
 
4
+ # Set:
4
5
  Vedeu.configure do
5
6
  cooked!
6
7
  # ...
7
8
  end
9
+
10
+ # Get:
11
+ Vedeu.config.cooked?
@@ -9,6 +9,7 @@ Enabling debugging will:
9
9
  - Produce a full a backtrace to STDOUT and the log file upon
10
10
  unrecoverable error or unhandled exception.
11
11
 
12
+ # Set:
12
13
  Vedeu.configure do
13
14
  debug!
14
15
  # ...
@@ -18,3 +19,6 @@ Enabling debugging will:
18
19
  debug false
19
20
  # ...
20
21
  end
22
+
23
+ # Get:
24
+ Vedeu.config.debug?
@@ -1,6 +1,10 @@
1
1
  Sets boolean to run a DRb server.
2
2
 
3
+ # Set:
3
4
  Vedeu.configure do
4
5
  drb!
5
6
  # ...
6
7
  end
8
+
9
+ # Get:
10
+ Vedeu.config.drb?
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ TESTCASE = 'dsl_app_040'
9
+
10
+ class DSLApp
11
+
12
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
13
+
14
+ Vedeu.configure do
15
+ colour background: '#ff0000', foreground: '#00ff00'
16
+ debug!
17
+ height 10
18
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
19
+ renderers [
20
+ Vedeu::Renderers::Terminal.new(
21
+ filename: Dir.tmpdir + "/#{TESTCASE}.out",
22
+ write_file: true),
23
+ # Vedeu::Renderers::JSON.new(filename: Dir.tmpdir + "/#{TESTCASE}.json"),
24
+ # Vedeu::Renderers::HTML.new(filename: Dir.tmpdir + "/#{TESTCASE}.html"),
25
+ # Vedeu::Renderers::Text.new(filename: Dir.tmpdir + "/#{TESTCASE}.txt"),
26
+ ]
27
+ run_once!
28
+ standalone!
29
+ end
30
+
31
+ load File.dirname(__FILE__) + '/support/test_interface.rb'
32
+
33
+ Vedeu.render do
34
+ view(:test_interface) do
35
+ line 'Background is #ff0000'
36
+ line 'Foreground is #00ff00'
37
+ end
38
+ end
39
+
40
+ def self.start(argv = ARGV)
41
+ Vedeu::Launcher.execute!(argv)
42
+ end
43
+
44
+ end # DSLApp
45
+
46
+ Vedeu.timer('Test') do
47
+ DSLApp.start
48
+ end
49
+
50
+ load File.dirname(__FILE__) + '/test_runner.rb'
51
+ TestRunner.result(TESTCASE, __FILE__)
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ TESTCASE = 'dsl_app_041'
9
+
10
+ class DSLApp
11
+
12
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
13
+
14
+ Vedeu.configure do
15
+ background '#003300'
16
+ debug!
17
+ height 10
18
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
19
+ renderers [
20
+ Vedeu::Renderers::Terminal.new(
21
+ filename: Dir.tmpdir + "/#{TESTCASE}.out",
22
+ write_file: true),
23
+ # Vedeu::Renderers::JSON.new(filename: Dir.tmpdir + "/#{TESTCASE}.json"),
24
+ # Vedeu::Renderers::HTML.new(filename: Dir.tmpdir + "/#{TESTCASE}.html"),
25
+ # Vedeu::Renderers::Text.new(filename: Dir.tmpdir + "/#{TESTCASE}.txt"),
26
+ ]
27
+ run_once!
28
+ standalone!
29
+ end
30
+
31
+ load File.dirname(__FILE__) + '/support/test_interface.rb'
32
+
33
+ Vedeu.render do
34
+ view(:test_interface) do
35
+ line 'Background is #003300'
36
+ line 'Foreground is default'
37
+ end
38
+ end
39
+
40
+ def self.start(argv = ARGV)
41
+ Vedeu::Launcher.execute!(argv)
42
+ end
43
+
44
+ end # DSLApp
45
+
46
+ Vedeu.timer('Test') do
47
+ DSLApp.start
48
+ end
49
+
50
+ load File.dirname(__FILE__) + '/test_runner.rb'
51
+ TestRunner.result(TESTCASE, __FILE__)
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ TESTCASE = 'dsl_app_042'
9
+
10
+ class DSLApp
11
+
12
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
13
+
14
+ Vedeu.configure do
15
+ foreground '#ff0000'
16
+ debug!
17
+ height 10
18
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
19
+ renderers [
20
+ Vedeu::Renderers::Terminal.new(
21
+ filename: Dir.tmpdir + "/#{TESTCASE}.out",
22
+ write_file: true),
23
+ # Vedeu::Renderers::JSON.new(filename: Dir.tmpdir + "/#{TESTCASE}.json"),
24
+ # Vedeu::Renderers::HTML.new(filename: Dir.tmpdir + "/#{TESTCASE}.html"),
25
+ # Vedeu::Renderers::Text.new(filename: Dir.tmpdir + "/#{TESTCASE}.txt"),
26
+ ]
27
+ run_once!
28
+ standalone!
29
+ end
30
+
31
+ load File.dirname(__FILE__) + '/support/test_interface.rb'
32
+
33
+ Vedeu.render do
34
+ view(:test_interface) do
35
+ line 'Background is default'
36
+ line 'Foreground is #ff0000'
37
+ end
38
+ end
39
+
40
+ def self.start(argv = ARGV)
41
+ Vedeu::Launcher.execute!(argv)
42
+ end
43
+
44
+ end # DSLApp
45
+
46
+ Vedeu.timer('Test') do
47
+ DSLApp.start
48
+ end
49
+
50
+ load File.dirname(__FILE__) + '/test_runner.rb'
51
+ TestRunner.result(TESTCASE, __FILE__)
@@ -0,0 +1 @@
1
+ (0l(B(0q(B Test (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(BBackground is #ff0000(0x(B(0x(BForeground is #00ff00(0x(B(0x(B(0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B
@@ -0,0 +1 @@
1
+ (0l(B(0q(B Test (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(BBackground is #003300(0x(B(0x(BForeground is default(0x(B(0x(B(0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B
@@ -0,0 +1 @@
1
+ (0l(B(0q(B Test (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(BBackground is default(0x(B(0x(BForeground is #ff0000(0x(B(0x(B(0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B
@@ -33,6 +33,9 @@ cd "$(dirname "$0")"
33
33
  ./dsl_app_022.rb
34
34
  ./dsl_app_030.rb
35
35
  ./dsl_app_031.rb
36
+ ./dsl_app_040.rb
37
+ ./dsl_app_041.rb
38
+ ./dsl_app_042.rb
36
39
 
37
40
  # Test some border functionality
38
41
  ./dsl_app_border_001.rb # border off
data/lib/vedeu/boolean.rb CHANGED
@@ -24,17 +24,23 @@ module Vedeu
24
24
  value ? true : false
25
25
  end
26
26
 
27
+ # Returns a boolean indicating whether the value should be
28
+ # considered false.
29
+ #
27
30
  # @return [Boolean]
28
31
  def false?
29
32
  value.nil? || value == false
30
33
  end
34
+ alias falsy? false?
31
35
 
36
+ # Returns a boolean indicating whether the value should be
37
+ # considered true.
38
+ #
32
39
  # @return [Boolean]
33
40
  def true?
34
- return false if false?
35
-
36
- true
41
+ !false?
37
42
  end
43
+ alias truthy? true?
38
44
 
39
45
  private
40
46
 
@@ -45,6 +45,7 @@ module Vedeu
45
45
 
46
46
  end # Vedeu
47
47
 
48
+ require 'vedeu/buffers/clear'
48
49
  require 'vedeu/buffers/empty'
49
50
  require 'vedeu/buffers/view'
50
51
  require 'vedeu/buffers/buffer'
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vedeu
4
+
5
+ module Buffers
6
+
7
+ # Provides a grid of Vedeu::Cells::Clear objects at the given
8
+ # height and width.
9
+ #
10
+ # @api private
11
+ #
12
+ class Clear
13
+
14
+ include Vedeu::Repositories::Defaults
15
+
16
+ # @!attribute [r] name
17
+ # @return [NilClass|String|Symbol]
18
+ attr_reader :name
19
+
20
+ # @return [Array<Array<Vedeu::Cells::Clear>>]
21
+ def buffer
22
+ @buffer ||= clear
23
+ end
24
+
25
+ # @return [Fixnum]
26
+ def height
27
+ @height + 1
28
+ end
29
+
30
+ # @return [Fixnum]
31
+ def width
32
+ @width + 1
33
+ end
34
+
35
+ private
36
+
37
+ # @macro interface_by_name
38
+ def interface
39
+ @_interface ||= Vedeu.interfaces.by_name(name)
40
+ end
41
+
42
+ # @macro defaults_method
43
+ def defaults
44
+ {
45
+ height: Vedeu.height,
46
+ name: nil,
47
+ width: Vedeu.width,
48
+ }
49
+ end
50
+
51
+ # @return [Array<Array<Vedeu::Cells::Clear>>]
52
+ def clear
53
+ Array.new(height) do
54
+ Array.new(width) do
55
+ Vedeu::Cells::Clear.new(colour: interface.colour, name: name)
56
+ end
57
+ end
58
+ end
59
+
60
+ end # Clear
61
+
62
+ end # Buffers
63
+
64
+ end # Vedeu
data/lib/vedeu/common.rb CHANGED
@@ -69,7 +69,7 @@ module Vedeu
69
69
  # @param value [void]
70
70
  # @return [Boolean]
71
71
  def falsy?(value)
72
- value.nil? || value.is_a?(FalseClass)
72
+ Vedeu::Boolean.new(value).false?
73
73
  end
74
74
 
75
75
  # Returns a boolean indicating whether the value is a Hash.
@@ -188,7 +188,7 @@ module Vedeu
188
188
  # @param value [void]
189
189
  # @return [Boolean]
190
190
  def truthy?(value)
191
- !falsy?(value)
191
+ Vedeu::Boolean.new(value).true?
192
192
  end
193
193
 
194
194
  # Returns a boolean indicating the model is a
@@ -98,10 +98,10 @@ module Vedeu
98
98
 
99
99
  # @return [Boolean]
100
100
  def inside_geometry?
101
- x >= geometry.x &&
102
- x <= geometry.xn &&
103
- y >= geometry.y &&
104
- y <= geometry.yn
101
+ x >= geometry.x &&
102
+ x <= geometry.xn &&
103
+ y >= geometry.y &&
104
+ y <= geometry.yn
105
105
  end
106
106
 
107
107
  # @return [Symbol]
@@ -71,14 +71,12 @@ module Vedeu
71
71
  # defined, then starting write space characters over the area
72
72
  # which the interface occupies.
73
73
  #
74
- # @return [Array<Array<Vedeu::Cells::Char>>]
74
+ # @return [Array<Array<Vedeu::Cells::Clear>>]
75
75
  def output
76
76
  Vedeu.timer("Clearing interface: '#{name}'") do
77
- @_clear ||= Array.new(height) do
78
- Array.new(width) do
79
- Vedeu::Cells::Clear.new(colour: colour, name: name)
80
- end
81
- end
77
+ @_clear ||= Vedeu::Buffers::Clear.new(height: height,
78
+ name: name,
79
+ width: width).buffer
82
80
  end
83
81
  end
84
82
 
@@ -73,13 +73,17 @@ module Vedeu
73
73
  @_interface ||= Vedeu.interfaces.by_name(name)
74
74
  end
75
75
 
76
+ # @param iy [Fixnum]
77
+ # @return [String]
78
+ def optimised_line(iy)
79
+ Vedeu::Geometries::Position.new(by + iy, bx).to_s + colour.to_s + chars
80
+ end
81
+
76
82
  # @return [String]
77
83
  def optimised_output
78
84
  Vedeu.timer("Optimised clearing content: '#{name}'") do
79
85
  Array.new(bordered_height) do |iy|
80
- Vedeu::Geometries::Position.new(by + iy, bx).to_s +
81
- colour.to_s +
82
- chars
86
+ optimised_line(iy)
83
87
  end.join + Vedeu::Geometries::Position.new(by, bx)
84
88
  end
85
89
  end
@@ -89,14 +93,12 @@ module Vedeu
89
93
  # defined, then starting write space characters over the area
90
94
  # which the interface occupies.
91
95
  #
92
- # @return [Array<Array<Vedeu::Cells::Char>>]
96
+ # @return [Array<Array<Vedeu::Cells::Clear>>]
93
97
  def output
94
98
  Vedeu.timer("Clearing content: '#{name}'") do
95
- @_clear ||= Array.new(bordered_height) do
96
- Array.new(bordered_width) do
97
- Vedeu::Cells::Clear.new(colour: colour, name: name)
98
- end
99
- end
99
+ @_clear ||= Vedeu::Buffers::Clear.new(height: bordered_height,
100
+ name: name,
101
+ width: bordered_width).buffer
100
102
  end
101
103
  end
102
104
 
@@ -35,12 +35,7 @@ module Vedeu
35
35
  @same = ''
36
36
  @compress ||= Vedeu.timer(message) do
37
37
  content.map do |cell|
38
- character = [
39
- position_for(cell),
40
- colour_for(cell),
41
- style_for(cell),
42
- value_for(cell),
43
- ].join
38
+ character = character_for(cell)
44
39
 
45
40
  character == @same ? next : @same = character
46
41
  end.join.tap do |out|
@@ -58,6 +53,15 @@ module Vedeu
58
53
 
59
54
  private
60
55
 
56
+ # @param char [Vedeu::Cells::Char]
57
+ # @return [String]
58
+ def character_for(char)
59
+ position_for(char) +
60
+ colour_for(char) +
61
+ style_for(char) +
62
+ value_for(char)
63
+ end
64
+
61
65
  # Compress by not repeatedly sending the same colours for each
62
66
  # character which has the same colours as the last character
63
67
  # output.
data/lib/vedeu/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
  module Vedeu
4
4
 
5
5
  # The current version of Vedeu.
6
- VERSION = '0.8.30'
6
+ VERSION = '0.8.31'
7
7
 
8
8
  end # Vedeu
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ module Vedeu
6
+
7
+ module Buffers
8
+
9
+ describe Clear do
10
+
11
+ let(:described) { Vedeu::Buffers::Clear }
12
+ let(:instance) { described.new(attributes) }
13
+ let(:attributes) {
14
+ {
15
+ height: height,
16
+ name: _name,
17
+ width: width,
18
+ }
19
+ }
20
+ let(:height) { 4 }
21
+ let(:_name) { :vedeu_buffers_empty }
22
+ let(:width) { 9 }
23
+
24
+ let(:term_height) { 8 }
25
+ let(:term_width) { 15 }
26
+
27
+ before do
28
+ Vedeu.stubs(:height).returns(term_height)
29
+ Vedeu.stubs(:width).returns(term_width)
30
+ end
31
+
32
+ describe '#initialize' do
33
+ it { instance.must_be_instance_of(described) }
34
+
35
+ context 'when the height is given' do
36
+ it { instance.instance_variable_get('@height').must_equal(height) }
37
+ end
38
+
39
+ context 'when the height not is given' do
40
+ let(:height) {}
41
+
42
+ it do
43
+ instance.instance_variable_get('@height').must_equal(term_height)
44
+ end
45
+ end
46
+
47
+ it { instance.instance_variable_get('@name').must_equal(_name) }
48
+
49
+ context 'when the width is given' do
50
+ it { instance.instance_variable_get('@width').must_equal(width) }
51
+ end
52
+
53
+ context 'when the width not is given' do
54
+ let(:width) {}
55
+
56
+ it { instance.instance_variable_get('@width').must_equal(term_width) }
57
+ end
58
+ end
59
+
60
+ describe '#buffer' do
61
+ subject { instance.buffer }
62
+
63
+ it { subject.must_be_instance_of(Array) }
64
+ it { subject.first.must_be_instance_of(Array) }
65
+ it { subject.first.first.must_be_instance_of(Vedeu::Cells::Clear) }
66
+
67
+ it { subject.size.must_equal(height + 1) }
68
+ it { subject.first.size.must_equal(width + 1) }
69
+ end
70
+
71
+ describe '#height' do
72
+ it { instance.must_respond_to(:height) }
73
+ end
74
+
75
+ describe '#name' do
76
+ it { instance.must_respond_to(:name) }
77
+ end
78
+
79
+ describe '#width' do
80
+ it { instance.must_respond_to(:width) }
81
+ end
82
+
83
+ end # Clear
84
+
85
+ end # Buffers
86
+
87
+ end # Vedeu
@@ -82,8 +82,6 @@ module Vedeu
82
82
  end
83
83
 
84
84
  describe '#buffer' do
85
- let(:position) { Vedeu::Geometries::Position.new(y, x) }
86
-
87
85
  subject { instance.buffer }
88
86
 
89
87
  it { subject.must_be_instance_of(Array) }
@@ -68,7 +68,7 @@ module Vedeu
68
68
  it { subject.must_be_instance_of(Array) }
69
69
 
70
70
  it do
71
- Vedeu.expects(:render_output).with(output)
71
+ Vedeu.expects(:render_output)
72
72
  subject
73
73
  end
74
74
 
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.8.30
4
+ version: 0.8.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-21 00:00:00.000000000 Z
11
+ date: 2016-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -235,7 +235,6 @@ files:
235
235
  - bin/vedeu_drb_client
236
236
  - bin/vedeu_drb_server
237
237
  - bin/vedeu_test
238
- - config/rubocop_enabled.yml
239
238
  - docs/api.md
240
239
  - docs/applications/existing_application.md
241
240
  - docs/applications/first_application.md
@@ -568,6 +567,9 @@ files:
568
567
  - integrations/dsl_app_022.rb
569
568
  - integrations/dsl_app_030.rb
570
569
  - integrations/dsl_app_031.rb
570
+ - integrations/dsl_app_040.rb
571
+ - integrations/dsl_app_041.rb
572
+ - integrations/dsl_app_042.rb
571
573
  - integrations/dsl_app_border_001.rb
572
574
  - integrations/dsl_app_border_002.rb
573
575
  - integrations/dsl_app_border_003.rb
@@ -607,6 +609,9 @@ files:
607
609
  - integrations/expected/dsl_app_022.out
608
610
  - integrations/expected/dsl_app_030.out
609
611
  - integrations/expected/dsl_app_031.out
612
+ - integrations/expected/dsl_app_040.out
613
+ - integrations/expected/dsl_app_041.out
614
+ - integrations/expected/dsl_app_042.out
610
615
  - integrations/expected/dsl_app_border_001.out
611
616
  - integrations/expected/dsl_app_border_002.out
612
617
  - integrations/expected/dsl_app_border_003.out
@@ -648,6 +653,7 @@ files:
648
653
  - lib/vedeu/borders/title.rb
649
654
  - lib/vedeu/buffers/all.rb
650
655
  - lib/vedeu/buffers/buffer.rb
656
+ - lib/vedeu/buffers/clear.rb
651
657
  - lib/vedeu/buffers/empty.rb
652
658
  - lib/vedeu/buffers/null.rb
653
659
  - lib/vedeu/buffers/refresh.rb
@@ -917,6 +923,7 @@ files:
917
923
  - test/lib/vedeu/borders/title_test.rb
918
924
  - test/lib/vedeu/buffers/all_test.rb
919
925
  - test/lib/vedeu/buffers/buffer_test.rb
926
+ - test/lib/vedeu/buffers/clear_test.rb
920
927
  - test/lib/vedeu/buffers/empty_test.rb
921
928
  - test/lib/vedeu/buffers/null_test.rb
922
929
  - test/lib/vedeu/buffers/refresh_content_test.rb
@@ -1184,6 +1191,7 @@ test_files:
1184
1191
  - test/lib/vedeu/borders/title_test.rb
1185
1192
  - test/lib/vedeu/buffers/all_test.rb
1186
1193
  - test/lib/vedeu/buffers/buffer_test.rb
1194
+ - test/lib/vedeu/buffers/clear_test.rb
1187
1195
  - test/lib/vedeu/buffers/empty_test.rb
1188
1196
  - test/lib/vedeu/buffers/null_test.rb
1189
1197
  - test/lib/vedeu/buffers/refresh_content_test.rb
@@ -1,16 +0,0 @@
1
- Lint/Eval:
2
- Description: 'The use of eval represents a serious security risk.'
3
- Enabled: false
4
-
5
- Metrics/ClassLength:
6
- Description: 'Avoid classes longer than 100 lines of code.'
7
- Enabled: false
8
-
9
- Style/AsciiComments:
10
- Description: 'Use only ascii symbols in comments.'
11
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
12
- Enabled: false
13
-
14
- Style/Documentation:
15
- Description: 'Document classes and non-namespace modules.'
16
- Enabled: false