vedeu 0.6.0 → 0.6.1

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: 28c51799d818421857c42dfc95970d49794fa75f
4
- data.tar.gz: dd35047e639be0064234964695a8b4f853ea4e54
3
+ metadata.gz: e2572d8a6656ea1dabfd4fc7ffb4fe69b661d7f1
4
+ data.tar.gz: 5f682d6d0b7948c52014ce4ab11e390dff755c6c
5
5
  SHA512:
6
- metadata.gz: ae7a0e4eca0ba65eb6e285681147f9938fba540bda076c10c09a47bcd8fae0eee253508f335540bd049be3ad85885974103332012ca4c878e526669fd0337fb8
7
- data.tar.gz: 93cb36006d06bdf9acfd10fca1c527bdfb9cbd12eb5d73ee4feae73bb51a33e49bc5fdbd8a34d13a64ef905adac9493605711ba21072f9220750d588fd953ce0
6
+ metadata.gz: 75e150c79ba83513d5e55310479b76c5c2f4710786d274fd43959814a0659cdeee9385b0d74e86f2444c27a06a083d2e259c7f39ae567eb96d24e1be22c46b3a
7
+ data.tar.gz: b19de309102aecf1b8ccb88a093b575ae201565de462a57119234c15e7d183581f9841d7e89634ae6d9f91f2a5c533b328c80f0e3096585a9ca52bb664486c44
data/.rubocop.yml CHANGED
@@ -37,7 +37,7 @@ AllCops:
37
37
  # Style guide URLs are not displayed in offense messages by default. Change
38
38
  # behavior by overriding DisplayStyleGuide, or by giving the
39
39
  # -S/--display-style-guide option.
40
- DisplayStyleGuide: false
40
+ DisplayStyleGuide: true
41
41
  # Additional cops that do not reference a style guide rule may be enabled by
42
42
  # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
43
43
  # the --only-guide-cops option.
@@ -133,7 +133,7 @@ Metrics/ClassLength:
133
133
 
134
134
  # Avoid complex methods.
135
135
  Metrics/CyclomaticComplexity:
136
- Max: 10
136
+ Max: 12
137
137
 
138
138
  Metrics/LineLength:
139
139
  Max: 80
@@ -45,9 +45,11 @@ class VedeuViewTemplateApp
45
45
  Vedeu.border('default') do
46
46
  colour foreground: '#aadd00', background: '#000000'
47
47
  end
48
+
48
49
  Vedeu.border('prune') do
49
50
  colour foreground: '#00aadd', background: '#000000'
50
51
  end
52
+
51
53
  Vedeu.border('wrap') do
52
54
  colour foreground: '#dd00aa', background: '#000000'
53
55
  end
@@ -75,9 +77,11 @@ class VedeuViewTemplateApp
75
77
  def self.default_template
76
78
  File.dirname(__FILE__) + '/default.erb'
77
79
  end
80
+
78
81
  def self.prune_template
79
82
  File.dirname(__FILE__) + '/prune.erb'
80
83
  end
84
+
81
85
  def self.wrap_template
82
86
  File.dirname(__FILE__) + '/wrap.erb'
83
87
  end
data/lib/vedeu/all.rb CHANGED
@@ -170,6 +170,7 @@ require 'vedeu/api'
170
170
  require 'vedeu/internal_api'
171
171
 
172
172
  require 'vedeu/bindings/application'
173
+ require 'vedeu/bindings/document'
173
174
  require 'vedeu/bindings/drb'
174
175
  require 'vedeu/bindings/menus'
175
176
  require 'vedeu/bindings/movement'
@@ -18,6 +18,7 @@ module Vedeu
18
18
  Vedeu::Events.reset!
19
19
 
20
20
  Vedeu::Bindings::Application.setup!
21
+ Vedeu::Bindings::Document.setup!
21
22
  Vedeu::Bindings::Visibility.setup!
22
23
  Vedeu::Bindings::Movement.setup!
23
24
  Vedeu::Bindings::Menus.setup!
@@ -0,0 +1,146 @@
1
+ module Vedeu
2
+
3
+ module Bindings
4
+
5
+ # System events relating to the document/editor/fake terminal
6
+ # implementation.
7
+ #
8
+ # :nocov:
9
+ module Document
10
+
11
+ extend self
12
+
13
+ # Setup events relating to the document/editor/fake terminal. This method
14
+ # is called by Vedeu.
15
+ #
16
+ # @return [TrueClass]
17
+ def setup!
18
+ editor_execute!
19
+ editor_delete_character!
20
+ editor_delete_line!
21
+ editor_down!
22
+ editor_insert_character!
23
+ editor_insert_line!
24
+ editor_left!
25
+ editor_right!
26
+ editor_up!
27
+ end
28
+
29
+ private
30
+
31
+ # @example
32
+ # Vedeu.trigger(:_editor_execute_, name)
33
+ #
34
+ # @return [TrueClass]
35
+ def editor_execute!
36
+ Vedeu.bind(:_editor_execute_) do |name|
37
+ Vedeu.documents.by_name(name).execute
38
+ end
39
+ end
40
+
41
+ # This event attempts to delete the character in the named document at the
42
+ # current virtual cursor position.
43
+ #
44
+ # @example
45
+ # Vedeu.trigger(:_editor_delete_character_, name)
46
+ #
47
+ # @return [TrueClass]
48
+ def editor_delete_character!
49
+ Vedeu.bind(:_editor_delete_character_) do |name|
50
+ Vedeu.documents.by_name(name).delete_character
51
+ end
52
+ end
53
+
54
+ # This event attempts to delete the line in the named document at the
55
+ # current virtual cursor position.
56
+ #
57
+ # @example
58
+ # Vedeu.trigger(:_editor_delete_line_, name)
59
+ #
60
+ # @return [TrueClass]
61
+ def editor_delete_line!
62
+ Vedeu.bind(:_editor_delete_line_) do |name|
63
+ Vedeu.documents.by_name(name).delete_line
64
+ end
65
+ end
66
+
67
+ # This event attempts to move the virtual cursor down by one line in the
68
+ # named document.
69
+ #
70
+ # @example
71
+ # Vedeu.trigger(:_editor_down_, name)
72
+ #
73
+ # @return [TrueClass]
74
+ def editor_down!
75
+ Vedeu.bind(:_editor_down_) do |name|
76
+ Vedeu.documents.by_name(name).down
77
+ end
78
+ end
79
+
80
+ # This event attempts to insert the given character in the named document
81
+ # at the current virtual cursor position.
82
+ #
83
+ # @example
84
+ # Vedeu.trigger(:_editor_insert_character_, name, character)
85
+ #
86
+ # @return [TrueClass]
87
+ def editor_insert_character!
88
+ Vedeu.bind(:_editor_insert_character_) do |name, character|
89
+ Vedeu.documents.by_name(name).insert_character(character)
90
+ end
91
+ end
92
+
93
+ # This event attempts to insert a new line in the named document at the
94
+ # current virtual cursor position.
95
+ #
96
+ # @example
97
+ # Vedeu.trigger(:_editor_insert_line_, name)
98
+ #
99
+ # @return [TrueClass]
100
+ def editor_insert_line!
101
+ Vedeu.bind(:_editor_insert_line_) do |name|
102
+ Vedeu.documents.by_name(name).insert_line
103
+ end
104
+ end
105
+
106
+ # This event attempts to move the virtual cursor left by one character in
107
+ # the named document.
108
+ #
109
+ # @example
110
+ # Vedeu.trigger(:_editor_left_, name)
111
+ #
112
+ # @return [TrueClass]
113
+ def editor_left!
114
+ Vedeu.bind(:_editor_left_) { |name| Vedeu.documents.by_name(name).left }
115
+ end
116
+
117
+ # This event attempts to move the virtual cursor right by one character in
118
+ # the named document.
119
+ #
120
+ # @example
121
+ # Vedeu.trigger(:_editor_right_, name)
122
+ #
123
+ # @return [TrueClass]
124
+ def editor_right!
125
+ Vedeu.bind(:_editor_right_) do |name|
126
+ Vedeu.documents.by_name(name).right
127
+ end
128
+ end
129
+
130
+ # This event attempts to move the virtual cursor up by one line in the
131
+ # named document.
132
+ #
133
+ # @example
134
+ # Vedeu.trigger(:_editor_up_, name)
135
+ #
136
+ # @return [TrueClass]
137
+ def editor_up!
138
+ Vedeu.bind(:_editor_up_) { |name| Vedeu.documents.by_name(name).up }
139
+ end
140
+
141
+ end # Document
142
+ # :nocov:
143
+
144
+ end # Bindings
145
+
146
+ end # Vedeu
@@ -60,6 +60,7 @@ module Vedeu
60
60
  end
61
61
 
62
62
  end # Focus
63
+ # :nocov:
63
64
 
64
65
  end # Bindings
65
66
 
@@ -71,6 +71,7 @@ module Vedeu
71
71
  end
72
72
 
73
73
  end # Refresh
74
+ # :nocov:
74
75
 
75
76
  end # Bindings
76
77
 
@@ -197,8 +197,8 @@ module Vedeu
197
197
  end
198
198
 
199
199
  end # System
200
+ # :nocov:
200
201
 
201
202
  end # Bindings
202
- # :nocov:
203
203
 
204
204
  end # Vedeu
@@ -118,7 +118,7 @@ module Vedeu
118
118
  # @option attributes vertical [String] The vertical border character.
119
119
  # @return [Vedeu::Border]
120
120
  def initialize(attributes = {})
121
- @attributes = defaults.merge!(attributes)
121
+ @attributes = defaults.merge!(attributes)
122
122
 
123
123
  @attributes.each { |key, value| instance_variable_set("@#{key}", value) }
124
124
  end
@@ -8,10 +8,9 @@ module Vedeu
8
8
 
9
9
  end # Vedeu
10
10
 
11
- require 'vedeu/input/capture'
12
- require 'vedeu/input/editor/editor'
13
-
11
+ require 'vedeu/input/editor/capture'
14
12
  require 'vedeu/input/editor/cropper'
13
+ require 'vedeu/input/editor/editor'
15
14
  require 'vedeu/input/editor/line'
16
15
  require 'vedeu/input/editor/lines'
17
16
  require 'vedeu/input/editor/virtual_cursor'
@@ -34,32 +34,23 @@ module Vedeu
34
34
  keys = console.getch
35
35
 
36
36
  if keys.ord == ESCAPE_KEY_CODE
37
- # Vedeu.log(type: :debug, message: "#keys: Escape detected...")
38
37
  @chars = 3
39
38
 
40
39
  begin
41
- # Vedeu.log(type: :debug,
42
- # message: "#keys: Attempting read_nonblock(#{@chars})")
43
40
  keys << console.read_nonblock(@chars)
44
41
 
45
42
  rescue IO::WaitReadable
46
- # Vedeu.log(type: :debug,
47
- # message: "#keys: (#{@chars}) Rescuing IO::WaitReadable")
48
43
  IO.select([console])
49
44
  @chars -= 1
50
45
  retry
51
46
 
52
47
  rescue IO::WaitWritable
53
- # Vedeu.log(type: :debug,
54
- # message: "#keys: (#{@chars}) Rescuing IO::WaitWritable")
55
48
  IO.select(nil, [console])
56
49
  @chars -= 1
57
50
  retry
58
51
 
59
52
  end
60
53
  end
61
- # Vedeu.log(type: :debug,
62
- # message: "#keys: Sending result: #{keys.inspect}")
63
54
 
64
55
  keys
65
56
  end
@@ -57,14 +57,14 @@ module Vedeu
57
57
  #
58
58
  # @return [Vedeu::Editor::Lines]
59
59
  def lines
60
- (@lines[oy...(oy + height)] || [])
60
+ @lines[oy...(oy + height)] || []
61
61
  end
62
62
 
63
63
  # Return a range of visible characters from each line.
64
64
  #
65
65
  # @return [String]
66
66
  def columns(line)
67
- (line[ox...(ox + width)] || '')
67
+ line[ox...(ox + width)] || ''
68
68
  end
69
69
 
70
70
  end # Editor
@@ -19,12 +19,8 @@ module Vedeu
19
19
 
20
20
  def_delegators :cursor,
21
21
  :bol,
22
- :down,
23
- :left,
24
22
  :ox,
25
23
  :oy,
26
- :right,
27
- :up,
28
24
  :x,
29
25
  :y
30
26
 
@@ -71,7 +67,7 @@ module Vedeu
71
67
 
72
68
  left
73
69
 
74
- store
70
+ refresh
75
71
  end
76
72
 
77
73
  # Delete a line.
@@ -82,7 +78,32 @@ module Vedeu
82
78
 
83
79
  up
84
80
 
85
- store
81
+ refresh
82
+ end
83
+
84
+ # Move the virtual cursor down.
85
+ #
86
+ # @return [Vedeu::Editor::Document]
87
+ def down
88
+ cursor.down
89
+
90
+ refresh
91
+ end
92
+
93
+ # Returns the document as a string with line breaks if there is more than
94
+ # one line.
95
+ #
96
+ # @return [String]
97
+ def execute
98
+ command = lines.map(&:to_s).join("\n")
99
+
100
+ reset!
101
+
102
+ clear
103
+
104
+ Vedeu.trigger(:_command_, command)
105
+
106
+ command
86
107
  end
87
108
 
88
109
  # Inserts the given character in to the line where the cursor is currently
@@ -97,7 +118,7 @@ module Vedeu
97
118
 
98
119
  right
99
120
 
100
- store
121
+ refresh
101
122
  end
102
123
 
103
124
  # Insert an empty line.
@@ -110,7 +131,16 @@ module Vedeu
110
131
 
111
132
  bol
112
133
 
113
- store
134
+ refresh
135
+ end
136
+
137
+ # Move the virtual cursor left.
138
+ #
139
+ # @return [Vedeu::Editor::Document]
140
+ def left
141
+ cursor.left
142
+
143
+ refresh
114
144
  end
115
145
 
116
146
  # Returns the current line from the collection of lines.
@@ -150,26 +180,37 @@ module Vedeu
150
180
 
151
181
  @lines = defaults[:data]
152
182
 
153
- store
183
+ refresh
154
184
  end
155
185
 
156
- # Returns the document as a string with line breaks if there is more than
157
- # one line.
186
+ # Store the document in the documents repository, clear and render the
187
+ # view.
158
188
  #
159
- # @return [String]
160
- def retrieve
161
- lines.map(&:to_s).join("\n")
189
+ # @return [Vedeu::Editor::Document]
190
+ def refresh
191
+ store
192
+
193
+ render
194
+
195
+ self
162
196
  end
163
197
 
164
- # Store the document in the documents repository and render the view.
198
+ # Move the virtual cursor right.
165
199
  #
166
200
  # @return [Vedeu::Editor::Document]
167
- def store
168
- super
201
+ def right
202
+ cursor.right
169
203
 
170
- render
204
+ refresh
205
+ end
171
206
 
172
- self
207
+ # Move the virtual cursor up.
208
+ #
209
+ # @return [Vedeu::Editor::Document]
210
+ def up
211
+ cursor.up
212
+
213
+ refresh
173
214
  end
174
215
 
175
216
  private
@@ -214,7 +255,8 @@ module Vedeu
214
255
  output = ''
215
256
 
216
257
  visible.each_with_index do |line, y_index|
217
- output << Vedeu::Position.new((by + y_index), bx).to_s + line.to_s
258
+ output << Vedeu::Position.new((by + y_index), bx).to_s
259
+ output << line.to_s
218
260
  end
219
261
 
220
262
  output << cursor.to_s
@@ -19,10 +19,12 @@ module Vedeu
19
19
  :left,
20
20
  :render,
21
21
  :reset!,
22
- :retrieve,
22
+ :execute,
23
23
  :right,
24
24
  :up
25
25
 
26
+ # Send given input to the named document.
27
+ #
26
28
  # @param name [String]
27
29
  # @param input [String|Symbol]
28
30
  # @return [void]
@@ -40,6 +42,8 @@ module Vedeu
40
42
  @name = name
41
43
  end
42
44
 
45
+ # Send given input to the named document.
46
+ #
43
47
  # @return [String|Symbol]
44
48
  def keypress
45
49
  return input unless document
@@ -52,14 +56,12 @@ module Vedeu
52
56
  when :escape then Vedeu.trigger(:_mode_switch_)
53
57
  when :left then left
54
58
  when :right then right
55
- when :tab then command
59
+ when :tab then execute
56
60
  when :up then up
57
61
  # when '' then delete_line
58
62
  else
59
63
  insert_character(input)
60
64
  end
61
-
62
- render unless input == :enter
63
65
  end
64
66
 
65
67
  protected
@@ -74,18 +76,6 @@ module Vedeu
74
76
 
75
77
  private
76
78
 
77
- #
78
- # @return []
79
- def command
80
- command = retrieve
81
-
82
- reset!
83
-
84
- clear
85
-
86
- Vedeu.trigger(:_command_, command)
87
- end
88
-
89
79
  # Return the document by name from the documents repository.
90
80
  #
91
81
  # @return [Vedeu::Editor::Document]
@@ -40,24 +40,22 @@ module Vedeu
40
40
 
41
41
  # Returns a new instance of Vedeu::Editor::VirtualCursor.
42
42
  #
43
- # @param y [Fixnum] The current line.
44
- # @param x [Fixnum] The current character with the line.
45
- # @param by [Fixnum]
46
- # @param bx [Fixnum]
47
- # @param byn [Fixnum]
48
- # @param bxn [Fixnum]
49
- # @param oy [Fixnum]
50
- # @param ox [Fixnum]
43
+ # @param attributes [Hash]
44
+ # @option attributes y [Fixnum] The current line.
45
+ # @option attributes x [Fixnum] The current character with the line.
46
+ # @option attributes by [Fixnum]
47
+ # @option attributes bx [Fixnum]
48
+ # @option attributes byn [Fixnum]
49
+ # @option attributes bxn [Fixnum]
50
+ # @option attributes oy [Fixnum]
51
+ # @option attributes ox [Fixnum]
51
52
  # @return [Vedeu::Editor::VirtualCursor]
52
- def initialize(y: 0, x: 0, by:, bx:, byn:, bxn:, oy: 0, ox: 0)
53
- @y = (y.nil? || y < 0) ? 0 : y
54
- @x = (x.nil? || x < 0) ? 0 : x
55
- @by = by
56
- @bx = bx
57
- @byn = byn
58
- @bxn = bxn
59
- @ox = ox
60
- @oy = oy
53
+ def initialize(attributes = {})
54
+ @attributes = defaults.merge!(attributes)
55
+
56
+ @attributes.each do |key, value|
57
+ instance_variable_set("@#{key}", value)
58
+ end
61
59
  end
62
60
 
63
61
  # Move the virtual cursor to the beginning of the line.
@@ -146,6 +144,22 @@ module Vedeu
146
144
 
147
145
  private
148
146
 
147
+ # Returns the default options/attributes for this class.
148
+ #
149
+ # @return [Hash<Symbol => Fixnum|NilClass>]
150
+ def defaults
151
+ {
152
+ y: 0,
153
+ x: 0,
154
+ by: nil,
155
+ bx: nil,
156
+ byn: nil,
157
+ bxn: nil,
158
+ ox: 0,
159
+ oy: 0,
160
+ }
161
+ end
162
+
149
163
  # Return the real y coordinate.
150
164
  #
151
165
  # @return [Fixnum]
@@ -22,7 +22,7 @@ module Vedeu
22
22
  {}
23
23
  end
24
24
 
25
- # :nocov
25
+ # :nocov:
26
26
 
27
27
  end # RendererOptions
28
28
 
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.6.0'
4
+ VERSION = '0.6.1'
5
5
 
6
6
  end
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Bindings
6
+
7
+ describe Document do
8
+
9
+ context 'the system events needed by Vedeu to run are defined' do
10
+ it { Vedeu.bound?(:_editor_execute_).must_equal(true) }
11
+ it { Vedeu.bound?(:_editor_delete_character_).must_equal(true) }
12
+ it { Vedeu.bound?(:_editor_delete_line_).must_equal(true) }
13
+ it { Vedeu.bound?(:_editor_down_).must_equal(true) }
14
+ it { Vedeu.bound?(:_editor_insert_character_).must_equal(true) }
15
+ it { Vedeu.bound?(:_editor_insert_line_).must_equal(true) }
16
+ it { Vedeu.bound?(:_editor_left_).must_equal(true) }
17
+ it { Vedeu.bound?(:_editor_right_).must_equal(true) }
18
+ it { Vedeu.bound?(:_editor_up_).must_equal(true) }
19
+ end
20
+
21
+ end # Document
22
+
23
+ end # Bindings
24
+
25
+ end # Vedeu
@@ -42,8 +42,24 @@ module Vedeu
42
42
  end
43
43
 
44
44
  describe '#clear' do
45
+ let(:expected) {
46
+ "\e[1;1H\e[1;1H " \
47
+ "\e[2;1H " \
48
+ "\e[3;1H " \
49
+ "\e[4;1H " \
50
+ "\e[5;1H " \
51
+ "\e[1;1H"
52
+ }
53
+
54
+ before do
55
+ Vedeu::Geometry.new(name: _name, x: 1, y: 1, xn: 5, yn: 5).store
56
+ Vedeu::Terminal.stubs(:output)
57
+ Vedeu::Direct.stubs(:write).returns(expected)
58
+ end
59
+
45
60
  subject { instance.clear }
46
61
 
62
+ it { subject.must_equal(expected) }
47
63
  end
48
64
 
49
65
  describe '#delete_character' do
@@ -67,6 +83,21 @@ module Vedeu
67
83
  # it { skip }
68
84
  end
69
85
 
86
+ describe '#down' do
87
+ subject { instance.down }
88
+
89
+ it { subject.must_be_instance_of(described) }
90
+ # it { skip }
91
+ end
92
+
93
+ describe '#execute' do
94
+ subject { instance.execute }
95
+
96
+ it { subject.must_be_instance_of(String) }
97
+
98
+ it { subject.must_equal("Hydrogen\nHelium\nLithium") }
99
+ end
100
+
70
101
  describe '#insert_character' do
71
102
  let(:character) { 'a' }
72
103
 
@@ -93,6 +124,13 @@ module Vedeu
93
124
  # it { skip }
94
125
  end
95
126
 
127
+ describe '#left' do
128
+ subject { instance.left }
129
+
130
+ it { subject.must_be_instance_of(described) }
131
+ # it { skip }
132
+ end
133
+
96
134
  describe '#line' do
97
135
  subject { instance.line }
98
136
 
@@ -164,16 +202,8 @@ module Vedeu
164
202
  it { subject.must_be_instance_of(described) }
165
203
  end
166
204
 
167
- describe '#retrieve' do
168
- subject { instance.retrieve }
169
-
170
- it { subject.must_be_instance_of(String) }
171
-
172
- it { subject.must_equal("Hydrogen\nHelium\nLithium") }
173
- end
174
-
175
- describe '#store' do
176
- subject { instance.store }
205
+ describe '#refresh' do
206
+ subject { instance.refresh }
177
207
 
178
208
  it { subject.must_be_instance_of(described) }
179
209
 
@@ -183,6 +213,20 @@ module Vedeu
183
213
  }
184
214
  end
185
215
 
216
+ describe '#right' do
217
+ subject { instance.right }
218
+
219
+ it { subject.must_be_instance_of(described) }
220
+ # it { skip }
221
+ end
222
+
223
+ describe '#up' do
224
+ subject { instance.up }
225
+
226
+ it { subject.must_be_instance_of(described) }
227
+ # it { skip }
228
+ end
229
+
186
230
  end # Editor
187
231
 
188
232
  end # Editor
@@ -25,13 +25,13 @@ module Vedeu
25
25
  # document.stubs(:delete_character)
26
26
  # document.stubs(:delete_line)
27
27
  # document.stubs(:down)
28
+ # document.stubs(:execute)
28
29
  # document.stubs(:left)
29
30
  # document.stubs(:right)
30
31
  # document.stubs(:insert_character)
31
32
  # document.stubs(:insert_line)
32
33
  # document.stubs(:render)
33
34
  # document.stubs(:reset!)
34
- # document.stubs(:retrieve)
35
35
  # document.stubs(:up)
36
36
  end
37
37
 
@@ -123,7 +123,7 @@ module Vedeu
123
123
  let(:data) { mock(:empty? => false) }
124
124
 
125
125
  # it {
126
- # document.expects(:retrieve).returns(data)
126
+ # document.expects(:execute).returns(data)
127
127
  # document.expects(:reset!)
128
128
  # document.expects(:clear)
129
129
  # Vedeu.expects(:trigger).with(:_command_, data)
@@ -144,7 +144,7 @@ module Vedeu
144
144
  context 'when the input is a symbol' do
145
145
  let(:input) { :ctrl_p }
146
146
 
147
- it { subject.must_be_instance_of(String) }
147
+ it { subject.must_be_instance_of(Vedeu::Editor::Document) }
148
148
  end
149
149
 
150
150
  context 'when the input is not a symbol' do
@@ -6,16 +6,19 @@ module Vedeu
6
6
 
7
7
  describe VirtualCursor do
8
8
 
9
- let(:described) { Vedeu::Editor::VirtualCursor }
10
- let(:instance) {
11
- described.new(y: y,
12
- x: x,
13
- bx: bx,
14
- by: by,
15
- byn: byn,
16
- bxn: bxn,
17
- oy: oy,
18
- ox: ox)
9
+ let(:described) { Vedeu::Editor::VirtualCursor }
10
+ let(:instance) { described.new(attributes) }
11
+ let(:attributes) {
12
+ {
13
+ y: y,
14
+ x: x,
15
+ bx: bx,
16
+ by: by,
17
+ byn: byn,
18
+ bxn: bxn,
19
+ oy: oy,
20
+ ox: ox
21
+ }
19
22
  }
20
23
  let(:y) { 0 }
21
24
  let(:x) { 0 }
@@ -28,6 +31,9 @@ module Vedeu
28
31
 
29
32
  describe '#initialize' do
30
33
  it { instance.must_be_instance_of(described) }
34
+ it {
35
+ instance.instance_variable_get('@attributes').must_equal(attributes)
36
+ }
31
37
  it { instance.instance_variable_get('@y').must_equal(y) }
32
38
  it { instance.instance_variable_get('@x').must_equal(x) }
33
39
  it { instance.instance_variable_get('@by').must_equal(by) }
data/vedeu.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'minitest-reporters', '1.0.20'
27
27
  spec.add_development_dependency 'mocha', '1.1.0'
28
28
  spec.add_development_dependency 'pry', '0.10.1'
29
- spec.add_development_dependency 'rubocop', '0.33.0'
29
+ spec.add_development_dependency 'rubocop', '0.34.0'
30
30
  spec.add_development_dependency 'ruby-prof', '0.15.8'
31
31
  spec.add_development_dependency 'simplecov', '0.10.0'
32
32
  spec.add_development_dependency 'simplecov-console', '0.2.0'
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.6.0
4
+ version: 0.6.1
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-08-30 00:00:00.000000000 Z
11
+ date: 2015-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.33.0
103
+ version: 0.34.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.33.0
110
+ version: 0.34.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ruby-prof
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -268,6 +268,7 @@ files:
268
268
  - lib/vedeu/application/view.rb
269
269
  - lib/vedeu/bindings/application.rb
270
270
  - lib/vedeu/bindings/bindings.rb
271
+ - lib/vedeu/bindings/document.rb
271
272
  - lib/vedeu/bindings/drb.rb
272
273
  - lib/vedeu/bindings/focus.rb
273
274
  - lib/vedeu/bindings/menus.rb
@@ -343,8 +344,8 @@ files:
343
344
  - lib/vedeu/geometry/geometry.rb
344
345
  - lib/vedeu/geometry/grid.rb
345
346
  - lib/vedeu/geometry/position.rb
346
- - lib/vedeu/input/capture.rb
347
347
  - lib/vedeu/input/editor/all.rb
348
+ - lib/vedeu/input/editor/capture.rb
348
349
  - lib/vedeu/input/editor/cropper.rb
349
350
  - lib/vedeu/input/editor/document.rb
350
351
  - lib/vedeu/input/editor/documents.rb
@@ -454,6 +455,7 @@ files:
454
455
  - test/lib/vedeu/application/view_test.rb
455
456
  - test/lib/vedeu/bindings/application_test.rb
456
457
  - test/lib/vedeu/bindings/bindings_test.rb
458
+ - test/lib/vedeu/bindings/document_test.rb
457
459
  - test/lib/vedeu/bindings/drb_test.rb
458
460
  - test/lib/vedeu/bindings/focus_test.rb
459
461
  - test/lib/vedeu/bindings/menus_test.rb
@@ -520,7 +522,7 @@ files:
520
522
  - test/lib/vedeu/geometry/geometry_test.rb
521
523
  - test/lib/vedeu/geometry/grid_test.rb
522
524
  - test/lib/vedeu/geometry/position_test.rb
523
- - test/lib/vedeu/input/capture_test.rb
525
+ - test/lib/vedeu/input/editor/capture_test.rb
524
526
  - test/lib/vedeu/input/editor/cropper_test.rb
525
527
  - test/lib/vedeu/input/editor/document_test.rb
526
528
  - test/lib/vedeu/input/editor/documents_test.rb
@@ -658,6 +660,7 @@ test_files:
658
660
  - test/lib/vedeu/application/view_test.rb
659
661
  - test/lib/vedeu/bindings/application_test.rb
660
662
  - test/lib/vedeu/bindings/bindings_test.rb
663
+ - test/lib/vedeu/bindings/document_test.rb
661
664
  - test/lib/vedeu/bindings/drb_test.rb
662
665
  - test/lib/vedeu/bindings/focus_test.rb
663
666
  - test/lib/vedeu/bindings/menus_test.rb
@@ -724,7 +727,7 @@ test_files:
724
727
  - test/lib/vedeu/geometry/geometry_test.rb
725
728
  - test/lib/vedeu/geometry/grid_test.rb
726
729
  - test/lib/vedeu/geometry/position_test.rb
727
- - test/lib/vedeu/input/capture_test.rb
730
+ - test/lib/vedeu/input/editor/capture_test.rb
728
731
  - test/lib/vedeu/input/editor/cropper_test.rb
729
732
  - test/lib/vedeu/input/editor/document_test.rb
730
733
  - test/lib/vedeu/input/editor/documents_test.rb