vedeu 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/vedeu/borders/border.rb +0 -1
- data/lib/vedeu/borders/refresh.rb +2 -1
- data/lib/vedeu/borders/title.rb +0 -2
- data/lib/vedeu/cells/empty.rb +0 -1
- data/lib/vedeu/common.rb +0 -13
- data/lib/vedeu/configuration/api.rb +0 -2
- data/lib/vedeu/cursors/cursor.rb +2 -1
- data/lib/vedeu/dsl/view.rb +0 -1
- data/lib/vedeu/editor/editor.rb +0 -1
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +0 -1
- data/lib/vedeu/geometries/position.rb +2 -1
- data/lib/vedeu/logging/debug.rb +2 -1
- data/lib/vedeu/logging/timer.rb +2 -1
- data/lib/vedeu/output/write.rb +0 -1
- data/lib/vedeu/presentation/presentation.rb +6 -3
- data/lib/vedeu/renderers/all.rb +4 -2
- data/lib/vedeu/repositories/model.rb +1 -0
- data/lib/vedeu/runtime/application.rb +4 -2
- data/lib/vedeu/runtime/launcher.rb +2 -1
- data/lib/vedeu/terminal/terminal.rb +4 -2
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/stream.rb +0 -1
- data/test/lib/vedeu/common_test.rb +0 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bb1e8c2812d147e206fcf64ca9368aeb8279173
|
4
|
+
data.tar.gz: f33d3cde6d4bf100b6bde1a0c5ccc957ee6e21ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 664f3b8051ec7c810b0d1f06899136a021a0a32daadd17b8d0585387266547302ba4e9c9e78b1cd0854751a42d6be17b5424a46414c687666d54f1b9523537ff
|
7
|
+
data.tar.gz: 3a6915c9877f6a1ad8487c09be66d5033ee3b948cbaa3ceac51b25ade8781d08976dc0cb6ba8d5c1bea3b3d93656e8f10052ce41c17a091aff9cc6dd0444b670
|
data/.rubocop.yml
CHANGED
data/lib/vedeu/borders/border.rb
CHANGED
data/lib/vedeu/borders/title.rb
CHANGED
data/lib/vedeu/cells/empty.rb
CHANGED
data/lib/vedeu/common.rb
CHANGED
@@ -24,19 +24,6 @@ module Vedeu
|
|
24
24
|
klass.new(attributes)
|
25
25
|
end
|
26
26
|
|
27
|
-
# Removes the module part from the expression in the string.
|
28
|
-
#
|
29
|
-
# @example
|
30
|
-
# demodulize('Vedeu::SomeModule::SomeClass') # => "SomeClass"
|
31
|
-
#
|
32
|
-
# @param klass [Class|String]
|
33
|
-
# @return [String]
|
34
|
-
def demodulize(klass)
|
35
|
-
klass = klass.to_s
|
36
|
-
|
37
|
-
klass[(klass.rindex('::') + 2)..-1]
|
38
|
-
end
|
39
|
-
|
40
27
|
# Returns a boolean indicating whether the value is a Fixnum.
|
41
28
|
#
|
42
29
|
# @param value [Fixnum|void]
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -174,8 +174,9 @@ module Vedeu
|
|
174
174
|
# visibility. When passed a block, will position the cursor,
|
175
175
|
# yield and return the original position.
|
176
176
|
#
|
177
|
+
# @param block [Proc]
|
177
178
|
# @return [String]
|
178
|
-
def to_s
|
179
|
+
def to_s(&block)
|
179
180
|
return escape_sequence.to_s unless block_given?
|
180
181
|
|
181
182
|
"#{position}#{yield}#{escape_sequence}".freeze
|
data/lib/vedeu/dsl/view.rb
CHANGED
data/lib/vedeu/editor/editor.rb
CHANGED
data/lib/vedeu/esc/esc.rb
CHANGED
@@ -44,10 +44,11 @@ module Vedeu
|
|
44
44
|
|
45
45
|
# Return the escape sequence to render a border character.
|
46
46
|
#
|
47
|
+
# @param block [Proc]
|
47
48
|
# @return [String]
|
48
49
|
# @yieldreturn [void] The border character to wrap with border
|
49
50
|
# on and off escape sequences.
|
50
|
-
def border
|
51
|
+
def border(&block)
|
51
52
|
return '' unless block_given?
|
52
53
|
|
53
54
|
"#{border_on}#{yield}#{border_off}".freeze
|
@@ -111,10 +111,11 @@ module Vedeu
|
|
111
111
|
# the aforementioned, call the block and then reposition to this
|
112
112
|
# location.
|
113
113
|
#
|
114
|
+
# @param block [Proc]
|
114
115
|
# @return [String]
|
115
116
|
# @yieldreturn [String] Returns the block wrapped in position
|
116
117
|
# escape sequences.
|
117
|
-
def to_s
|
118
|
+
def to_s(&block)
|
118
119
|
return "#{sequence}#{yield}".freeze if block_given?
|
119
120
|
|
120
121
|
sequence
|
data/lib/vedeu/logging/debug.rb
CHANGED
@@ -20,9 +20,10 @@ module Vedeu
|
|
20
20
|
#
|
21
21
|
# @param filename [String] Optional, and defaults to being
|
22
22
|
# written to the /tmp directory.
|
23
|
+
# @param block [Proc]
|
23
24
|
# @return [void]
|
24
25
|
# @yieldreturn [void] The section of the application to profile.
|
25
|
-
def self.profile(filename = 'profile.html')
|
26
|
+
def self.profile(filename = 'profile.html', &block)
|
26
27
|
return nil unless block_given?
|
27
28
|
|
28
29
|
require 'ruby-prof'
|
data/lib/vedeu/logging/timer.rb
CHANGED
@@ -41,9 +41,10 @@ module Vedeu
|
|
41
41
|
# Write an entry to the log file stating how long a section of
|
42
42
|
# code took in milliseconds. Useful for debugging performance.
|
43
43
|
#
|
44
|
+
# @param block [Proc]
|
44
45
|
# @raise [Vedeu::Error::RequiresBlock]
|
45
46
|
# @return [void] The return value of the executed block.
|
46
|
-
def measure
|
47
|
+
def measure(&block)
|
47
48
|
fail Vedeu::Error::RequiresBlock unless block_given?
|
48
49
|
|
49
50
|
if Vedeu::Configuration.debug?
|
data/lib/vedeu/output/write.rb
CHANGED
@@ -23,13 +23,15 @@ module Vedeu
|
|
23
23
|
# Renders the colour attributes of the receiver and yields (to
|
24
24
|
# then render the styles).
|
25
25
|
#
|
26
|
+
# @param block [Proc]
|
26
27
|
# @return [String]
|
27
|
-
def render_colour
|
28
|
+
def render_colour(&block)
|
28
29
|
"#{colour}#{yield}".freeze
|
29
30
|
end
|
30
31
|
|
32
|
+
# @param block [Proc]
|
31
33
|
# @return [String]
|
32
|
-
def render_position
|
34
|
+
def render_position(&block)
|
33
35
|
return position.to_s { yield } if position?
|
34
36
|
|
35
37
|
yield
|
@@ -38,8 +40,9 @@ module Vedeu
|
|
38
40
|
# Renders the style attributes of the receiver and yields (to
|
39
41
|
# then render the next model, or finally, the content).
|
40
42
|
#
|
43
|
+
# @param block [Proc]
|
41
44
|
# @return [String]
|
42
|
-
def render_style
|
45
|
+
def render_style(&block)
|
43
46
|
"#{style}#{yield}".freeze
|
44
47
|
end
|
45
48
|
|
data/lib/vedeu/renderers/all.rb
CHANGED
@@ -104,8 +104,9 @@ module Vedeu
|
|
104
104
|
@storage ||= in_memory
|
105
105
|
end
|
106
106
|
|
107
|
+
# @param block [Proc]
|
107
108
|
# @return [void]
|
108
|
-
def threaded(renderer)
|
109
|
+
def threaded(renderer, &block)
|
109
110
|
Thread.new(renderer) do
|
110
111
|
mutex.synchronize do
|
111
112
|
toggle_cursor do
|
@@ -115,8 +116,9 @@ module Vedeu
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
119
|
+
# @param block [Proc]
|
118
120
|
# @return [void]
|
119
|
-
def toggle_cursor
|
121
|
+
def toggle_cursor(&block)
|
120
122
|
Vedeu.trigger(:_hide_cursor_)
|
121
123
|
|
122
124
|
yield
|
@@ -84,8 +84,9 @@ module Vedeu
|
|
84
84
|
# Runs the application loop either once, or forever (exceptions
|
85
85
|
# and signals permitting).
|
86
86
|
#
|
87
|
+
# @param block [Proc]
|
87
88
|
# @return [void]
|
88
|
-
def runner
|
89
|
+
def runner(&block)
|
89
90
|
return yield if configuration.once?
|
90
91
|
|
91
92
|
run_many { yield }
|
@@ -115,8 +116,9 @@ module Vedeu
|
|
115
116
|
# stopped when an uncaught exception occurs or when either the
|
116
117
|
# `:_mode_switch_` or `:_exit_` event is triggered.
|
117
118
|
#
|
119
|
+
# @param block [Proc]
|
118
120
|
# @return [void]
|
119
|
-
def run_many
|
121
|
+
def run_many(&block)
|
120
122
|
Vedeu::Runtime::MainLoop.start! { yield }
|
121
123
|
|
122
124
|
rescue Vedeu::Error::ModeSwitch
|
@@ -12,10 +12,11 @@ module Vedeu
|
|
12
12
|
# exit, attempts to restore the screen. See
|
13
13
|
# {Vedeu::Terminal#restore_screen}.
|
14
14
|
#
|
15
|
+
# @param block [Proc]
|
15
16
|
# @raise [Vedeu::Error::RequiresBlock] The required block was not
|
16
17
|
# given.
|
17
18
|
# @return [Array]
|
18
|
-
def open
|
19
|
+
def open(&block)
|
19
20
|
fail Vedeu::Error::RequiresBlock unless block_given?
|
20
21
|
|
21
22
|
if raw_mode? || fake_mode?
|
@@ -55,9 +56,10 @@ module Vedeu
|
|
55
56
|
true
|
56
57
|
end
|
57
58
|
|
59
|
+
# @param block [Proc]
|
58
60
|
# @param mode [Symbol]
|
59
61
|
# @return [void]
|
60
|
-
def initialize_screen(mode)
|
62
|
+
def initialize_screen(mode, &block)
|
61
63
|
Vedeu.log(message: "Terminal entering '#{mode}' mode".freeze)
|
62
64
|
|
63
65
|
output(Vedeu::EscapeSequences::Esc.screen_init)
|
data/lib/vedeu/version.rb
CHANGED
data/lib/vedeu/views/stream.rb
CHANGED
@@ -60,14 +60,6 @@ module Vedeu
|
|
60
60
|
it { subject.must_be_instance_of(Vedeu::Cells::Char) }
|
61
61
|
end
|
62
62
|
|
63
|
-
describe '#demodulize' do
|
64
|
-
let(:klass) { described }
|
65
|
-
|
66
|
-
subject { instance.demodulize(klass) }
|
67
|
-
|
68
|
-
it { subject.must_equal('VedeuCommonClass') }
|
69
|
-
end
|
70
|
-
|
71
63
|
describe '#numeric?' do
|
72
64
|
let(:_value) {}
|
73
65
|
|
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.7.
|
4
|
+
version: 0.7.4
|
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-12-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|