vedeu 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73d956c3dee89d057e89b5e730ca5ef5a974c229
4
- data.tar.gz: 769594b1a84d5f2194fa71ba56faf86c5744ea71
3
+ metadata.gz: 0bb1e8c2812d147e206fcf64ca9368aeb8279173
4
+ data.tar.gz: f33d3cde6d4bf100b6bde1a0c5ccc957ee6e21ae
5
5
  SHA512:
6
- metadata.gz: 7660a8daf5f90ad644122576bdffd1ff984d4b13166d253feabb510bf6c799ec92607ecd0eaf1407234606d308901129aa75c6f93e28b749f94729602698f4c8
7
- data.tar.gz: 322f163dda6a068a21f84f2ec53563dc69236e5f223ca3f4c73eca803c82919db630a188485233e2bb2abc18b4d822a08676057512c9c21cbceb860fa5eb0d52
6
+ metadata.gz: 664f3b8051ec7c810b0d1f06899136a021a0a32daadd17b8d0585387266547302ba4e9c9e78b1cd0854751a42d6be17b5424a46414c687666d54f1b9523537ff
7
+ data.tar.gz: 3a6915c9877f6a1ad8487c09be66d5033ee3b948cbaa3ceac51b25ade8781d08976dc0cb6ba8d5c1bea3b3d93656e8f10052ce41c17a091aff9cc6dd0444b670
data/.rubocop.yml CHANGED
@@ -28,6 +28,9 @@ AllCops:
28
28
  DisplayStyleGuide: true
29
29
  StyleGuideCopsOnly: false
30
30
 
31
+ Lint/UnusedMethodArgument:
32
+ Enabled: false
33
+
31
34
  Style/EmptyLinesAroundBlockBody:
32
35
  EnforcedStyle: no_empty_lines
33
36
 
@@ -17,7 +17,6 @@ module Vedeu
17
17
  class Border
18
18
 
19
19
  extend Forwardable
20
- include Vedeu::Common
21
20
  include Vedeu::Repositories::Model
22
21
  include Vedeu::Presentation
23
22
 
@@ -211,8 +211,9 @@ module Vedeu
211
211
  # the block.
212
212
  #
213
213
  # @param size [Fixnum]
214
+ # @param block [Proc]
214
215
  # @return [Array<void>]
215
- def build_collection(size)
216
+ def build_collection(size, &block)
216
217
  Array.new(size) { |e| yield(e) }
217
218
  end
218
219
 
@@ -13,8 +13,6 @@ module Vedeu
13
13
  #
14
14
  class Title
15
15
 
16
- include Vedeu::Common
17
-
18
16
  # @param (see #initialize)
19
17
  # @return (see #render)
20
18
  def self.render(name, value = '', horizontal = [])
@@ -13,7 +13,6 @@ module Vedeu
13
13
  class Empty
14
14
 
15
15
  include Comparable
16
- include Vedeu::Common
17
16
  include Vedeu::Presentation
18
17
  include Vedeu::Repositories::Defaults
19
18
 
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]
@@ -8,8 +8,6 @@ module Vedeu
8
8
  #
9
9
  class API
10
10
 
11
- include Vedeu::Common
12
-
13
11
  # @param (see #initialize)
14
12
  def self.configure(&block)
15
13
  new(&block).configuration
@@ -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
@@ -82,7 +82,6 @@ module Vedeu
82
82
  #
83
83
  class View
84
84
 
85
- include Vedeu::Common
86
85
  include Vedeu::DSL
87
86
  include Vedeu::Cursors::DSL
88
87
  include Vedeu::DSL::Presentation
@@ -7,7 +7,6 @@ module Vedeu
7
7
  #
8
8
  class Editor
9
9
 
10
- include Vedeu::Common
11
10
  extend Forwardable
12
11
 
13
12
  def_delegators :document,
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
@@ -73,7 +73,6 @@ module Vedeu
73
73
  #
74
74
  class DSL
75
75
 
76
- include Vedeu::Common
77
76
  include Vedeu::DSL
78
77
  include Vedeu::DSL::Use
79
78
  include Vedeu::Geometries::Validator
@@ -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
@@ -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'
@@ -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?
@@ -11,7 +11,6 @@ module Vedeu
11
11
  #
12
12
  class Write
13
13
 
14
- include Vedeu::Common
15
14
  include Vedeu::Presentation
16
15
 
17
16
  # @api public
@@ -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
 
@@ -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
@@ -7,6 +7,7 @@ module Vedeu
7
7
  #
8
8
  module Model
9
9
 
10
+ # This is used by including classes.
10
11
  include Vedeu::Common
11
12
 
12
13
  # @!attribute [rw] repository
@@ -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
@@ -88,8 +88,9 @@ module Vedeu
88
88
 
89
89
  private
90
90
 
91
+ # @param block [Proc]
91
92
  # @return [void]
92
- def optionally_profile
93
+ def optionally_profile(&block)
93
94
  if Vedeu::Configuration.profile?
94
95
  Vedeu.profile { yield }
95
96
 
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.7.3'.freeze
4
+ VERSION = '0.7.4'.freeze
5
5
 
6
6
  end
@@ -8,7 +8,6 @@ module Vedeu
8
8
  #
9
9
  class Stream
10
10
 
11
- include Vedeu::Common
12
11
  include Vedeu::Repositories::Model
13
12
  include Vedeu::Repositories::Parent
14
13
  include Vedeu::Presentation
@@ -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.3
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-06 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard