vedeu 0.6.15 → 0.6.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -60
- data/config/rubocop_enabled.yml +6 -1023
- data/docs/events/refresh.md +6 -2
- data/docs/events/visibility.md +8 -3
- data/lib/vedeu.rb +4 -3
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api/external.rb +6 -6
- data/lib/vedeu/bindings/bindings.rb +3 -3
- data/lib/vedeu/bindings/movement.rb +4 -4
- data/lib/vedeu/bindings/refresh.rb +9 -9
- data/lib/vedeu/bindings/visibility.rb +10 -12
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/buffers/refresh.rb +1 -1
- data/lib/vedeu/colours/repository.rb +1 -0
- data/lib/vedeu/colours/translator.rb +2 -6
- data/lib/vedeu/common.rb +2 -1
- data/lib/vedeu/configuration/api.rb +16 -7
- data/lib/vedeu/cursors/cursor.rb +12 -21
- data/lib/vedeu/cursors/refresh.rb +1 -1
- data/lib/vedeu/dsl/text.rb +21 -18
- data/lib/vedeu/dsl/use.rb +13 -11
- data/lib/vedeu/dsl/view.rb +52 -46
- data/lib/vedeu/editor/cursor.rb +2 -2
- data/lib/vedeu/editor/insert.rb +2 -6
- data/lib/vedeu/editor/line.rb +3 -8
- data/lib/vedeu/editor/lines.rb +1 -12
- data/lib/vedeu/events/event.rb +52 -43
- data/lib/vedeu/events/trigger.rb +7 -15
- data/lib/vedeu/geometry/generic_coordinate.rb +4 -12
- data/lib/vedeu/geometry/geometry.rb +1 -1
- data/lib/vedeu/input/translator.rb +50 -31
- data/lib/vedeu/models/focus.rb +33 -22
- data/lib/vedeu/models/group.rb +8 -7
- data/lib/vedeu/models/interface.rb +6 -10
- data/lib/vedeu/models/toggleable.rb +6 -9
- data/lib/vedeu/models/views/char.rb +24 -30
- data/lib/vedeu/models/views/html_char.rb +0 -33
- data/lib/vedeu/models/views/stream.rb +8 -7
- data/lib/vedeu/models/views/view.rb +9 -9
- data/lib/vedeu/options.rb +1 -1
- data/lib/vedeu/output/clear/all.rb +13 -0
- data/lib/vedeu/output/clear/{named_group.rb → group.rb} +4 -7
- data/lib/vedeu/output/clear/{named_interface.rb → interface.rb} +4 -7
- data/lib/vedeu/output/direct.rb +2 -2
- data/lib/vedeu/output/presentation/presentation.rb +10 -7
- data/lib/vedeu/output/renderers/all.rb +9 -4
- data/lib/vedeu/output/renderers/escape_sequence.rb +1 -1
- data/lib/vedeu/output/renderers/file.rb +1 -1
- data/lib/vedeu/output/renderers/null.rb +1 -1
- data/lib/vedeu/output/renderers/{renderer_options.rb → options.rb} +2 -2
- data/lib/vedeu/output/renderers/terminal.rb +1 -1
- data/lib/vedeu/output/renderers/text.rb +1 -1
- data/lib/vedeu/output/text.rb +4 -8
- data/lib/vedeu/output/viewport.rb +2 -6
- data/lib/vedeu/output/wordwrap.rb +2 -6
- data/lib/vedeu/repositories/repository.rb +9 -22
- data/lib/vedeu/runtime/application.rb +2 -6
- data/lib/vedeu/templating/view_template.rb +7 -15
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bindings/bindings_test.rb +32 -6
- data/test/lib/vedeu/bindings/refresh_test.rb +1 -0
- data/test/lib/vedeu/bindings/visibility_test.rb +1 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +2 -2
- data/test/lib/vedeu/colours/background_test.rb +0 -18
- data/test/lib/vedeu/colours/foreground_test.rb +0 -18
- data/test/lib/vedeu/cursors/refresh_test.rb +5 -3
- data/test/lib/vedeu/events/aliases_test.rb +0 -6
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/{named_group_test.rb → group_test.rb} +5 -5
- data/test/lib/vedeu/output/clear/{named_interface_test.rb → interface_test.rb} +4 -4
- data/test/lib/vedeu/output/renderers/{renderer_options_test.rb → options_test.rb} +2 -2
- data/vedeu.gemspec +1 -1
- metadata +14 -14
- data/config/rubocop_disabled.yml +0 -50
data/lib/vedeu/dsl/use.rb
CHANGED
@@ -8,10 +8,10 @@ module Vedeu
|
|
8
8
|
|
9
9
|
# Use the attribute of stored model.
|
10
10
|
#
|
11
|
-
# This DSL method provides access to a stored model by name.
|
12
|
-
# then request an attribute of that model for use within
|
13
|
-
# model. The models which current support this are
|
14
|
-
# Interface.
|
11
|
+
# This DSL method provides access to a stored model by name.
|
12
|
+
# You can then request an attribute of that model for use within
|
13
|
+
# the current model. The models which current support this are
|
14
|
+
# Border, Geometry and Interface.
|
15
15
|
#
|
16
16
|
# @example
|
17
17
|
# # Here the character used for 'my_border' is used in
|
@@ -21,14 +21,16 @@ module Vedeu
|
|
21
21
|
# end
|
22
22
|
#
|
23
23
|
# @note
|
24
|
-
# - Only models of the same repository can be used in this
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
24
|
+
# - Only models of the same repository can be used in this
|
25
|
+
# way.
|
26
|
+
# - If the stored model cannot be found, a ModelNotFound
|
27
|
+
# exception may be raised, or the request for an attribute
|
28
|
+
# may raise a NoMethodError exception.
|
28
29
|
#
|
29
|
-
# @param name [String] The name of the model with the value you
|
30
|
-
# use.
|
31
|
-
# @raise
|
30
|
+
# @param name [String] The name of the model with the value you
|
31
|
+
# wish to use.
|
32
|
+
# @raise
|
33
|
+
# [Vedeu::Error::ModelNotFound|Vedeu::Error::NoMethodError]
|
32
34
|
# The model or attribute cannot be found.
|
33
35
|
# @return [void] The stored model.
|
34
36
|
def use(name)
|
data/lib/vedeu/dsl/view.rb
CHANGED
@@ -2,16 +2,18 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module DSL
|
4
4
|
|
5
|
-
# There are two ways to construct views with Vedeu. You would like
|
6
|
-
# the view to the screen immediately (immediate render) or
|
7
|
-
# a view to be drawn when you trigger a refresh
|
5
|
+
# There are two ways to construct views with Vedeu. You would like
|
6
|
+
# to draw the view to the screen immediately (immediate render) or
|
7
|
+
# you want to save a view to be drawn when you trigger a refresh
|
8
|
+
# event later (deferred view).
|
8
9
|
#
|
9
|
-
# Both of these approaches require that you have defined an
|
10
|
-
# 'visible area') first. You can find out how to
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
10
|
+
# Both of these approaches require that you have defined an
|
11
|
+
# interface (or 'visible area') first. You can find out how to
|
12
|
+
# define an interface with Vedeu below or in
|
13
|
+
# {Vedeu::DSL::Interface}. The examples in 'Immediate Render' and
|
14
|
+
# 'Deferred View' use these interface definitions: (Note: should
|
15
|
+
# you use these examples, ensure your terminal is at least 70
|
16
|
+
# characters in width and 5 lines in height.)
|
15
17
|
#
|
16
18
|
# Vedeu.interface 'main' do
|
17
19
|
# geometry do
|
@@ -30,26 +32,27 @@ module Vedeu
|
|
30
32
|
# end
|
31
33
|
# end
|
32
34
|
#
|
33
|
-
# Both of these approaches use a concept of Buffers in Vedeu.
|
34
|
-
# three buffers for any defined interface. These are
|
35
|
-
# 'back', 'front' and 'previous'.
|
35
|
+
# Both of these approaches use a concept of Buffers in Vedeu.
|
36
|
+
# There are three buffers for any defined interface. These are
|
37
|
+
# imaginatively called: 'back', 'front' and 'previous'.
|
36
38
|
#
|
37
|
-
# The 'back' buffer is the content for an interface which will be
|
38
|
-
# time a refresh event is fired globally or for that
|
39
|
-
# becomes 'front'.
|
39
|
+
# The 'back' buffer is the content for an interface which will be
|
40
|
+
# shown next time a refresh event is fired globally or for that
|
41
|
+
# interface. So, 'back' becomes 'front'.
|
40
42
|
#
|
41
|
-
# The 'front' buffer is the content for an interface which is
|
42
|
-
# showing. When a refresh event is fired, again,
|
43
|
-
# interface specifically, the content of this
|
44
|
-
#
|
45
|
-
# this 'front' buffer.
|
43
|
+
# The 'front' buffer is the content for an interface which is
|
44
|
+
# currently showing. When a refresh event is fired, again,
|
45
|
+
# globally or for that interface specifically, the content of this
|
46
|
+
# 'front' buffer is first copied to the 'previous' buffer, and
|
47
|
+
# then the current 'back' buffer overwrites this 'front' buffer.
|
46
48
|
#
|
47
|
-
# The 'previous' buffer contains what was shown on the 'front'
|
48
|
-
# current 'front'.
|
49
|
+
# The 'previous' buffer contains what was shown on the 'front'
|
50
|
+
# before the current 'front'.
|
49
51
|
#
|
50
|
-
# You can only write to either the 'front' (you want the content
|
51
|
-
# immediately (immediate render)) or the 'back' (you
|
52
|
-
# to be drawn on the next refresh
|
52
|
+
# You can only write to either the 'front' (you want the content
|
53
|
+
# to be drawn immediately (immediate render)) or the 'back' (you
|
54
|
+
# would like the content to be drawn on the next refresh
|
55
|
+
# (deferred view)).
|
53
56
|
#
|
54
57
|
# The basic view DSL methods look like this:
|
55
58
|
#
|
@@ -91,9 +94,10 @@ module Vedeu
|
|
91
94
|
|
92
95
|
include Vedeu::Common
|
93
96
|
|
94
|
-
# Directly write a view buffer to the terminal. Using this
|
95
|
-
# that the refresh event does not need to be
|
96
|
-
# the views, though can be later
|
97
|
+
# Directly write a view buffer to the terminal. Using this
|
98
|
+
# method means that the refresh event does not need to be
|
99
|
+
# triggered after creating the views, though can be later
|
100
|
+
# triggered when needed.
|
97
101
|
#
|
98
102
|
# Vedeu.renders do
|
99
103
|
# view 'some_interface' do
|
@@ -124,8 +128,9 @@ module Vedeu
|
|
124
128
|
# end
|
125
129
|
# end
|
126
130
|
#
|
127
|
-
# @param block [Proc] The directives you wish to send to
|
128
|
-
# Typically includes `view` with associated
|
131
|
+
# @param block [Proc] The directives you wish to send to
|
132
|
+
# render. Typically includes `view` with associated
|
133
|
+
# sub-directives.
|
129
134
|
# @raise [Vedeu::Error::RequiresBlock]
|
130
135
|
# @return [Array<View>]
|
131
136
|
def renders(&block)
|
@@ -137,15 +142,15 @@ module Vedeu
|
|
137
142
|
|
138
143
|
# Define a view (content) for an interface.
|
139
144
|
#
|
140
|
-
# As you can see by comparing the examples above to these
|
141
|
-
# immediate render simply wraps what is already
|
142
|
-
# view.
|
145
|
+
# As you can see by comparing the examples above to these
|
146
|
+
# below, the immediate render simply wraps what is already
|
147
|
+
# here in the deferred view.
|
143
148
|
#
|
144
|
-
# The views declared within this block are stored in their
|
145
|
-
# interface back buffers until a refresh event
|
146
|
-
# event is triggered, the back
|
147
|
-
# buffers
|
148
|
-
# {Vedeu::Terminal#output}.
|
149
|
+
# The views declared within this block are stored in their
|
150
|
+
# respective interface back buffers until a refresh event
|
151
|
+
# occurs. When the refresh event is triggered, the back
|
152
|
+
# buffers are swapped into the front buffers and the content
|
153
|
+
# here will be rendered to {Vedeu::Terminal#output}.
|
149
154
|
#
|
150
155
|
# Vedeu.views do
|
151
156
|
# view 'some_interface' do
|
@@ -168,8 +173,9 @@ module Vedeu
|
|
168
173
|
# # ... some code
|
169
174
|
# end
|
170
175
|
#
|
171
|
-
# @param block [Proc] The directives you wish to send to
|
172
|
-
# Typically includes `view` with associated
|
176
|
+
# @param block [Proc] The directives you wish to send to
|
177
|
+
# render. Typically includes `view` with associated
|
178
|
+
# sub-directives.
|
173
179
|
# @raise [Vedeu::Error::RequiresBlock]
|
174
180
|
# @return [Array<View>]
|
175
181
|
def views(&block)
|
@@ -188,8 +194,8 @@ module Vedeu
|
|
188
194
|
eval('self', block.binding)
|
189
195
|
end
|
190
196
|
|
191
|
-
# Creates a new Vedeu::Views::Composition which may contain
|
192
|
-
# views (Vedeu::Views::View objects).
|
197
|
+
# Creates a new Vedeu::Views::Composition which may contain
|
198
|
+
# one or more views (Vedeu::Views::View objects).
|
193
199
|
#
|
194
200
|
# @param client [Object]
|
195
201
|
# @param block [Proc]
|
@@ -198,12 +204,12 @@ module Vedeu
|
|
198
204
|
Vedeu::Views::Composition.build(client: client, &block)
|
199
205
|
end
|
200
206
|
|
201
|
-
# Stores each of the views defined in their respective buffers
|
202
|
-
# be rendered on next refresh.
|
207
|
+
# Stores each of the views defined in their respective buffers
|
208
|
+
# ready to be rendered on next refresh.
|
203
209
|
#
|
204
210
|
# @param method [Symbol] An instruction; `:store_immediate` or
|
205
|
-
# `:store_deferred` which determines whether the view will
|
206
|
-
# immediately or later respectively.
|
211
|
+
# `:store_deferred` which determines whether the view will
|
212
|
+
# be shown immediately or later respectively.
|
207
213
|
# @param block [Proc]
|
208
214
|
# @return [Array]
|
209
215
|
def store(method, &block)
|
data/lib/vedeu/editor/cursor.rb
CHANGED
@@ -82,7 +82,7 @@ module Vedeu
|
|
82
82
|
# @return [Vedeu::Editor::Cursor]
|
83
83
|
def left
|
84
84
|
@ox -= 1 unless @ox == 0
|
85
|
-
@x
|
85
|
+
@x -= 1
|
86
86
|
|
87
87
|
self
|
88
88
|
end
|
@@ -121,7 +121,7 @@ module Vedeu
|
|
121
121
|
# @return [Vedeu::Editor::Cursor]
|
122
122
|
def up
|
123
123
|
@oy -= 1 unless @oy == 0
|
124
|
-
@y
|
124
|
+
@y -= 1
|
125
125
|
|
126
126
|
self
|
127
127
|
end
|
data/lib/vedeu/editor/insert.rb
CHANGED
@@ -28,13 +28,9 @@ module Vedeu
|
|
28
28
|
|
29
29
|
# @return [Vedeu::Editor::Line|Vedeu::Editor::Lines]
|
30
30
|
def insert
|
31
|
-
if index
|
32
|
-
collection.insert(index, entity)
|
31
|
+
return collection.insert(index, entity) if index
|
33
32
|
|
34
|
-
|
35
|
-
collection << entity
|
36
|
-
|
37
|
-
end
|
33
|
+
collection << entity
|
38
34
|
end
|
39
35
|
|
40
36
|
protected
|
data/lib/vedeu/editor/line.rb
CHANGED
@@ -16,15 +16,10 @@ module Vedeu
|
|
16
16
|
# @param line [String|Vedeu::Editor::Line]
|
17
17
|
# @return [Vedeu::Editor::Line]
|
18
18
|
def self.coerce(line)
|
19
|
-
return line
|
19
|
+
return line if line.is_a?(self)
|
20
|
+
return new(line) if line.is_a?(String)
|
20
21
|
|
21
|
-
|
22
|
-
new(line)
|
23
|
-
|
24
|
-
else
|
25
|
-
new
|
26
|
-
|
27
|
-
end
|
22
|
+
new
|
28
23
|
end
|
29
24
|
|
30
25
|
# Returns a new instance of Vedeu::Editor::Line.
|
data/lib/vedeu/editor/lines.rb
CHANGED
@@ -21,18 +21,7 @@ module Vedeu
|
|
21
21
|
new(document.lines)
|
22
22
|
|
23
23
|
elsif document.is_a?(Array)
|
24
|
-
lines = document.map
|
25
|
-
if line.is_a?(Vedeu::Editor::Line)
|
26
|
-
line
|
27
|
-
|
28
|
-
elsif line.is_a?(String)
|
29
|
-
Vedeu::Editor::Line.coerce(line)
|
30
|
-
|
31
|
-
else
|
32
|
-
Vedeu::Editor::Line.new
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
24
|
+
lines = document.map { |line| Vedeu::Editor::Line.coerce(line) }
|
36
25
|
|
37
26
|
new(lines)
|
38
27
|
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -2,31 +2,30 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Events
|
4
4
|
|
5
|
-
# Contains all the logic of an event. Handles debouncing and
|
5
|
+
# Contains all the logic of an event. Handles debouncing and
|
6
|
+
# throttling.
|
6
7
|
#
|
7
|
-
# Vedeu provides an event mechanism to facilitate the
|
8
|
-
# application. The events are either Vedeu
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
8
|
+
# Vedeu provides an event mechanism to facilitate the
|
9
|
+
# functionality of your application. The events are either Vedeu
|
10
|
+
# defined, ie. system events or user defined, ie. user events.
|
11
|
+
# User events allow you to orchestrate behaviour within your
|
12
|
+
# application, ie. the user presses a specific key,
|
13
|
+
# you trigger an event to make something happen. Eg. pressing 'p'
|
14
|
+
# instructs the player to play.
|
13
15
|
#
|
14
|
-
# Events described here assume that you have
|
15
|
-
#
|
16
|
+
# Events described here assume that you have bound the events
|
17
|
+
# within your classes:
|
16
18
|
#
|
17
19
|
# class SomeClassInYourApplication
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# #
|
22
|
-
# # be method calls or the triggering of another event or events.
|
20
|
+
# Vedeu.bind(:event_name) do |arg1, arg2|
|
21
|
+
# # Things that should happen when the event is triggered;
|
22
|
+
# # these can be method calls or the triggering of another
|
23
|
+
# # event or events.
|
23
24
|
# end
|
24
25
|
#
|
25
|
-
# or, you are prepared to use the `Vedeu` prefix:
|
26
|
-
#
|
27
|
-
# class SomeClassInYourApplication
|
28
26
|
# Vedeu.bind(:event_name) do
|
29
|
-
# # Not all events you define will have arguments; like
|
27
|
+
# # Not all events you define will have arguments; like
|
28
|
+
# # methods.
|
30
29
|
# :do_stuff
|
31
30
|
# end
|
32
31
|
#
|
@@ -36,20 +35,25 @@ module Vedeu
|
|
36
35
|
|
37
36
|
class << self
|
38
37
|
|
39
|
-
# Register an event by name with optional delay (throttling)
|
40
|
-
# triggered will execute the code contained within
|
38
|
+
# Register an event by name with optional delay (throttling)
|
39
|
+
# which when triggered will execute the code contained within
|
40
|
+
# the passed block.
|
41
41
|
#
|
42
|
-
# @param name [Symbol] The name of the event to be triggered
|
43
|
-
#
|
44
|
-
# @
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
# triggered
|
49
|
-
#
|
50
|
-
# @
|
51
|
-
#
|
52
|
-
#
|
42
|
+
# @param name [Symbol] The name of the event to be triggered
|
43
|
+
# later.
|
44
|
+
# @param options [Hash] The options to register the event
|
45
|
+
# with.
|
46
|
+
# @option options :delay [Fixnum|Float] Limits the execution
|
47
|
+
# of the triggered event to only execute when first
|
48
|
+
# triggered, with subsequent triggering being ignored until
|
49
|
+
# the delay has expired.
|
50
|
+
# @option options :debounce [Fixnum|Float] Limits the
|
51
|
+
# execution of the triggered event to only execute once the
|
52
|
+
# debounce has expired. Subsequent triggers before debounce
|
53
|
+
# expiry are ignored.
|
54
|
+
# @param block [Proc] The event to be executed when triggered.
|
55
|
+
# This block could be a method call, or the triggering of
|
56
|
+
# another event, or sequence of either/both.
|
53
57
|
#
|
54
58
|
# @example
|
55
59
|
# Vedeu.bind :my_event do |some, args|
|
@@ -87,7 +91,8 @@ module Vedeu
|
|
87
91
|
alias_method :event, :bind
|
88
92
|
alias_method :register, :bind
|
89
93
|
|
90
|
-
# Return a boolean indicating whether the named event is
|
94
|
+
# Return a boolean indicating whether the named event is
|
95
|
+
# registered.
|
91
96
|
#
|
92
97
|
# @example
|
93
98
|
# Vedeu.bound?(:some_event)
|
@@ -153,7 +158,8 @@ module Vedeu
|
|
153
158
|
true
|
154
159
|
end
|
155
160
|
|
156
|
-
# Triggers the event based on debouncing and throttling
|
161
|
+
# Triggers the event based on debouncing and throttling
|
162
|
+
# conditions.
|
157
163
|
#
|
158
164
|
# @param args [Array]
|
159
165
|
# @return [void]
|
@@ -194,9 +200,9 @@ module Vedeu
|
|
194
200
|
closure.call(*args)
|
195
201
|
end
|
196
202
|
|
197
|
-
# Returns a boolean indicating whether throttling is required
|
198
|
-
# event. Setting the delay option to any value greater
|
199
|
-
# throttling.
|
203
|
+
# Returns a boolean indicating whether throttling is required
|
204
|
+
# for this event. Setting the delay option to any value greater
|
205
|
+
# than 0 will enable throttling.
|
200
206
|
#
|
201
207
|
# @return [Boolean]
|
202
208
|
def throttling?
|
@@ -216,11 +222,12 @@ module Vedeu
|
|
216
222
|
false
|
217
223
|
end
|
218
224
|
|
219
|
-
# Returns a boolean indicating whether debouncing is required
|
220
|
-
# event. Setting the debounce option to any value
|
221
|
-
# enable debouncing.
|
222
|
-
# Sets the deadline for when this event can be executed to a
|
223
|
-
# future determined by the amount of debounce time
|
225
|
+
# Returns a boolean indicating whether debouncing is required
|
226
|
+
# for this event. Setting the debounce option to any value
|
227
|
+
# greater than 0 will enable debouncing.
|
228
|
+
# Sets the deadline for when this event can be executed to a
|
229
|
+
# point in the future determined by the amount of debounce time
|
230
|
+
# left.
|
224
231
|
#
|
225
232
|
# @return [Boolean]
|
226
233
|
def debouncing?
|
@@ -242,7 +249,8 @@ module Vedeu
|
|
242
249
|
false
|
243
250
|
end
|
244
251
|
|
245
|
-
# Returns a boolean indicating whether this event has a
|
252
|
+
# Returns a boolean indicating whether this event has a
|
253
|
+
# deadline.
|
246
254
|
#
|
247
255
|
# @return [Boolean]
|
248
256
|
def deadline?
|
@@ -263,7 +271,8 @@ module Vedeu
|
|
263
271
|
options[:delay] || defaults[:delay]
|
264
272
|
end
|
265
273
|
|
266
|
-
# Combines the options provided at instantiation with the
|
274
|
+
# Combines the options provided at instantiation with the
|
275
|
+
# default values.
|
267
276
|
#
|
268
277
|
# @return [Hash]
|
269
278
|
def options
|
data/lib/vedeu/events/trigger.rb
CHANGED
@@ -38,13 +38,9 @@ module Vedeu
|
|
38
38
|
#
|
39
39
|
# @return [Array]
|
40
40
|
def trigger
|
41
|
-
if results.one?
|
42
|
-
results[0]
|
41
|
+
return results[0] if results.one?
|
43
42
|
|
44
|
-
|
45
|
-
results
|
46
|
-
|
47
|
-
end
|
43
|
+
results
|
48
44
|
end
|
49
45
|
|
50
46
|
protected
|
@@ -72,17 +68,13 @@ module Vedeu
|
|
72
68
|
#
|
73
69
|
# @return [Array|Array<Vedeu::Events::Event>]
|
74
70
|
def registered_events
|
75
|
-
if repository.registered?(name)
|
76
|
-
repository.find(name)
|
77
|
-
|
78
|
-
else
|
79
|
-
Vedeu::Events::Aliases.find(name).map do |event_name|
|
80
|
-
Vedeu::Events::Trigger.trigger(event_name, *args)
|
81
|
-
end
|
82
|
-
|
83
|
-
[]
|
71
|
+
return repository.find(name) if repository.registered?(name)
|
84
72
|
|
73
|
+
Vedeu::Events::Aliases.find(name).map do |event_name|
|
74
|
+
Vedeu::Events::Trigger.trigger(event_name, *args)
|
85
75
|
end
|
76
|
+
|
77
|
+
[]
|
86
78
|
end
|
87
79
|
|
88
80
|
end # Trigger
|