vedeu 0.6.20 → 0.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -0
- data/Rakefile +13 -0
- data/bin/vedeu_drb_server +6 -6
- data/docs/api.md +14 -0
- data/docs/dsl.md +12 -12
- data/docs/events/document.md +4 -2
- data/docs/events/drb.md +4 -0
- data/docs/events/focus.md +2 -0
- data/docs/events/menu.md +2 -0
- data/docs/events/movement.md +7 -5
- data/docs/events/refresh.md +2 -0
- data/docs/events/system.md +5 -0
- data/docs/events/view.md +2 -0
- data/docs/events/visibility.md +2 -0
- data/lib/vedeu.rb +0 -23
- data/lib/vedeu/all.rb +2 -4
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/all.rb +3 -3
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/borders/dsl.rb +21 -27
- data/lib/vedeu/borders/null.rb +2 -15
- data/lib/vedeu/borders/render.rb +1 -1
- data/lib/vedeu/borders/repository.rb +9 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/null.rb +1 -31
- data/lib/vedeu/buffers/refresh.rb +8 -8
- data/lib/vedeu/buffers/repository.rb +9 -0
- data/lib/vedeu/colours/backgrounds.rb +9 -0
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/foregrounds.rb +9 -0
- data/lib/vedeu/common.rb +22 -13
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/cursors/cursor.rb +13 -8
- data/lib/vedeu/cursors/refresh.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +18 -1
- data/lib/vedeu/distributed/server.rb +23 -0
- data/lib/vedeu/distributed/templates/default_borders.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_geometries.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_interfaces.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_keymaps.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_menus.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_views.vedeu +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -17
- data/lib/vedeu/dsl/dsl.rb +12 -0
- data/lib/vedeu/dsl/interface.rb +32 -33
- data/lib/vedeu/dsl/keymap.rb +13 -19
- data/lib/vedeu/dsl/line.rb +3 -13
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/dsl/stream.rb +0 -10
- data/lib/vedeu/dsl/use.rb +6 -6
- data/lib/vedeu/dsl/view.rb +17 -19
- data/lib/vedeu/editor/cursor.rb +32 -10
- data/lib/vedeu/editor/document.rb +33 -35
- data/lib/vedeu/editor/editor.rb +3 -4
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -8
- data/lib/vedeu/editor/lines.rb +1 -1
- data/lib/vedeu/editor/repository.rb +9 -0
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/events/aliases.rb +8 -1
- data/lib/vedeu/events/event.rb +8 -0
- data/lib/vedeu/events/repository.rb +9 -0
- data/lib/vedeu/events/trigger.rb +9 -5
- data/lib/vedeu/geometry/coordinate.rb +2 -2
- data/lib/vedeu/geometry/dsl.rb +32 -38
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +3 -3
- data/lib/vedeu/geometry/null.rb +2 -24
- data/lib/vedeu/geometry/repository.rb +9 -0
- data/lib/vedeu/groups/clear.rb +7 -3
- data/lib/vedeu/groups/dsl.rb +29 -35
- data/lib/vedeu/groups/group.rb +28 -4
- data/lib/vedeu/groups/refresh.rb +3 -2
- data/lib/vedeu/groups/repository.rb +9 -0
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +9 -0
- data/lib/vedeu/input/mapper.rb +4 -0
- data/lib/vedeu/input/translator.rb +1 -1
- data/lib/vedeu/logging/debug.rb +13 -0
- data/lib/vedeu/logging/log.rb +8 -0
- data/lib/vedeu/logging/timer.rb +13 -0
- data/lib/vedeu/menus/dsl.rb +8 -18
- data/lib/vedeu/menus/menu.rb +8 -4
- data/lib/vedeu/menus/null.rb +1 -1
- data/lib/vedeu/menus/repository.rb +9 -0
- data/lib/vedeu/models/cell.rb +5 -0
- data/lib/vedeu/models/escape.rb +5 -0
- data/lib/vedeu/models/focus.rb +20 -5
- data/lib/vedeu/models/interface.rb +10 -1
- data/lib/vedeu/models/interfaces.rb +9 -0
- data/lib/vedeu/models/toggleable.rb +19 -4
- data/lib/vedeu/models/views/char.rb +6 -1
- data/lib/vedeu/models/views/html_char.rb +1 -4
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/generic.rb +14 -2
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/interface.rb +5 -1
- data/lib/vedeu/output/compressor.rb +8 -4
- data/lib/vedeu/output/direct.rb +4 -4
- data/lib/vedeu/output/presentation/all.rb +15 -0
- data/lib/vedeu/output/presentation/presentation.rb +0 -7
- data/lib/vedeu/output/refresh/refresh.rb +1 -3
- data/lib/vedeu/output/renderers/all.rb +10 -0
- data/lib/vedeu/output/renderers/terminal.rb +1 -3
- data/lib/vedeu/repositories/collection.rb +3 -3
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/repositories/store.rb +3 -2
- data/lib/vedeu/runtime/application.rb +4 -0
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +7 -0
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +8 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +0 -6
- data/test/lib/vedeu/borders/null_test.rb +0 -12
- data/test/lib/vedeu/buffers/null_test.rb +0 -37
- data/test/lib/vedeu/common_test.rb +33 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +0 -6
- data/test/lib/vedeu/dsl/dsl_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +0 -6
- data/test/lib/vedeu/dsl/keymap_test.rb +0 -5
- data/test/lib/vedeu/dsl/line_test.rb +0 -7
- data/test/lib/vedeu/dsl/stream_test.rb +0 -7
- data/test/lib/vedeu/editor/cursor_test.rb +23 -8
- data/test/lib/vedeu/editor/document_test.rb +27 -23
- data/test/lib/vedeu/editor/line_test.rb +0 -30
- data/test/lib/vedeu/geometry/dsl_test.rb +0 -5
- data/test/lib/vedeu/geometry/null_test.rb +0 -30
- data/test/lib/vedeu/groups/dsl_test.rb +0 -6
- data/test/lib/vedeu/groups/group_test.rb +15 -7
- data/test/lib/vedeu/menus/dsl_test.rb +0 -5
- data/test/lib/vedeu/models/cell_test.rb +4 -0
- data/test/lib/vedeu/models/escape_test.rb +4 -0
- data/test/lib/vedeu/models/views/char_test.rb +4 -0
- data/test/lib/vedeu/null/generic_test.rb +13 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +3 -2
- data/test/lib/vedeu_test.rb +81 -3
- data/test/support/examples/borders_app.rb +1 -3
- data/test/support/examples/drb_app.rb +1 -3
- data/test/support/examples/editor_app.rb +2 -4
- data/test/support/examples/focus_app.rb +1 -3
- data/test/support/examples/hello_world.rb +1 -6
- data/test/support/examples/material_colours_app.rb +1 -3
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
- data/test/support/helpers/model_test_class.rb +1 -5
- data/test/support/who.rb +29 -0
- data/test/test_helper.rb +0 -1
- metadata +5 -17
- data/lib/vedeu/api/all.rb +0 -15
- data/lib/vedeu/api/external.rb +0 -194
- data/lib/vedeu/api/internal.rb +0 -177
- data/test/lib/vedeu/api/external_test.rb +0 -74
- data/test/lib/vedeu/api/internal_test.rb +0 -33
- data/test/support/examples/typed_commands/command.erb +0 -1
- data/test/support/examples/typed_commands/output.erb +0 -1
- data/test/support/examples/typed_commands/status.erb +0 -1
- data/test/support/examples/typed_commands/typed_commands_app.rb +0 -94
@@ -16,4 +16,13 @@ module Vedeu
|
|
16
16
|
|
17
17
|
end # Geometry
|
18
18
|
|
19
|
+
# Manipulate the repository of geometries.
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Vedeu.geometries
|
23
|
+
#
|
24
|
+
# @!method geometries
|
25
|
+
# @return [Vedeu::Geometry::Repository]
|
26
|
+
def_delegators Vedeu::Geometry::Repository, :geometries
|
27
|
+
|
19
28
|
end # Vedeu
|
data/lib/vedeu/groups/clear.rb
CHANGED
@@ -13,7 +13,7 @@ module Vedeu
|
|
13
13
|
# @example
|
14
14
|
# Vedeu.clear_by_group(name)
|
15
15
|
#
|
16
|
-
# @param name [String]
|
16
|
+
# @param name [String|Symbol]
|
17
17
|
# @return [void]
|
18
18
|
def render(name)
|
19
19
|
new(name).render
|
@@ -25,7 +25,7 @@ module Vedeu
|
|
25
25
|
|
26
26
|
# Return a new instance of Vedeu::Groups::Clear.
|
27
27
|
#
|
28
|
-
# @param name [String]
|
28
|
+
# @param name [String|Symbol]
|
29
29
|
# @return [Vedeu::Groups::Clear]
|
30
30
|
def initialize(name)
|
31
31
|
@name = name
|
@@ -39,7 +39,7 @@ module Vedeu
|
|
39
39
|
protected
|
40
40
|
|
41
41
|
# @!attribute [r] name
|
42
|
-
# @return [String]
|
42
|
+
# @return [String|Symbol]
|
43
43
|
attr_reader :name
|
44
44
|
|
45
45
|
private
|
@@ -53,4 +53,8 @@ module Vedeu
|
|
53
53
|
|
54
54
|
end # Groups
|
55
55
|
|
56
|
+
# @!method clear_by_group
|
57
|
+
# @see Vedeu::Groups::Clear.render
|
58
|
+
def_delegators Vedeu::Groups::Clear, :clear_by_group
|
59
|
+
|
56
60
|
end # Vedeu
|
data/lib/vedeu/groups/dsl.rb
CHANGED
@@ -24,35 +24,35 @@ module Vedeu
|
|
24
24
|
# The example below resembles 'vim' (the popular terminal-based
|
25
25
|
# text editor):
|
26
26
|
#
|
27
|
-
# Vedeu.group
|
28
|
-
# add
|
27
|
+
# Vedeu.group :title_screen do
|
28
|
+
# add :welcome_interface
|
29
29
|
# # ... some code
|
30
30
|
# end
|
31
31
|
#
|
32
|
-
# Vedeu.group
|
33
|
-
# add
|
34
|
-
# add
|
35
|
-
# add
|
32
|
+
# Vedeu.group :main_screen do
|
33
|
+
# add :editor_interface
|
34
|
+
# add :status_interface
|
35
|
+
# add :command_interface
|
36
36
|
# # ... some code
|
37
37
|
# end
|
38
38
|
#
|
39
39
|
# or more succinctly:
|
40
40
|
#
|
41
|
-
# Vedeu.group
|
42
|
-
# members
|
43
|
-
#
|
44
|
-
#
|
41
|
+
# Vedeu.group :main_screen do
|
42
|
+
# members :editor_interface,
|
43
|
+
# :status_interface,
|
44
|
+
# :command_interface
|
45
45
|
# # ... some code
|
46
46
|
# end
|
47
47
|
#
|
48
48
|
# or when defining an interface:
|
49
49
|
#
|
50
|
-
# Vedeu.interface
|
51
|
-
# group
|
50
|
+
# Vedeu.interface :some_interface do
|
51
|
+
# group :some_group
|
52
52
|
# # ... some code
|
53
53
|
# end
|
54
54
|
#
|
55
|
-
# @param name [String] The name of this group.
|
55
|
+
# @param name [String|Symbol] The name of this group.
|
56
56
|
# @param block [Proc]
|
57
57
|
# @raise [Vedeu::Error::RequiresBlock]
|
58
58
|
# @return [Vedeu::Groups::Group]
|
@@ -62,44 +62,38 @@ module Vedeu
|
|
62
62
|
Vedeu::Groups::Group.build(name: name, &block).store
|
63
63
|
end
|
64
64
|
|
65
|
-
# Returns an instance of Groups::DSL.
|
66
|
-
#
|
67
|
-
# @param model [Vedeu::Groups::Group]
|
68
|
-
# @param client [Object]
|
69
|
-
# @return [Vedeu::Groups::DSL]
|
70
|
-
def initialize(model, client = nil)
|
71
|
-
@model = model
|
72
|
-
@client = client
|
73
|
-
end
|
74
|
-
|
75
65
|
# Add the named interface to this group.
|
76
66
|
#
|
77
|
-
# Vedeu.group
|
78
|
-
# add
|
67
|
+
# Vedeu.group :main_screen do
|
68
|
+
# add :editor_interface
|
79
69
|
# end
|
80
70
|
#
|
81
|
-
# @param
|
71
|
+
# @param name [String|Symbol]
|
82
72
|
# @return [Vedeu::Groups::Group]
|
83
|
-
def add(
|
84
|
-
model.add(
|
73
|
+
def add(name)
|
74
|
+
model.add(name)
|
85
75
|
end
|
86
76
|
|
87
77
|
# Add the named interfaces to this group in bulk.
|
88
78
|
#
|
89
|
-
# Vedeu.group
|
90
|
-
# members [
|
91
|
-
#
|
92
|
-
#
|
79
|
+
# Vedeu.group :main_screen do
|
80
|
+
# members [:editor_interface,
|
81
|
+
# :some_interface,
|
82
|
+
# :other_interface]
|
93
83
|
# end
|
94
84
|
#
|
95
|
-
# @param
|
85
|
+
# @param names [Array<String|Symbol>]
|
96
86
|
# @return [Array<String>]
|
97
|
-
def members(*
|
98
|
-
|
87
|
+
def members(*names)
|
88
|
+
names.each { |name| add(name) }
|
99
89
|
end
|
100
90
|
|
101
91
|
end # DSL
|
102
92
|
|
103
93
|
end # Groups
|
104
94
|
|
95
|
+
# @!method group
|
96
|
+
# @see Vedeu::Groups::DSL.group
|
97
|
+
def_delegators Vedeu::Groups::DSL, :group
|
98
|
+
|
105
99
|
end # Vedeu
|
data/lib/vedeu/groups/group.rb
CHANGED
@@ -14,6 +14,12 @@ module Vedeu
|
|
14
14
|
# @return [String]
|
15
15
|
attr_accessor :name
|
16
16
|
|
17
|
+
# @param (see #initialize)
|
18
|
+
# @return (see #initialize)
|
19
|
+
def self.store(attributes = {})
|
20
|
+
new(attributes).store
|
21
|
+
end
|
22
|
+
|
17
23
|
# Return a new instance of Vedeu::Groups::Group.
|
18
24
|
#
|
19
25
|
# @note
|
@@ -23,7 +29,7 @@ module Vedeu
|
|
23
29
|
# @param attributes [Hash]
|
24
30
|
# @option attributes members [Set] A collection of names of
|
25
31
|
# interfaces belonging to this group.
|
26
|
-
# @option attributes name [String] The name of the group.
|
32
|
+
# @option attributes name [String|Symbol] The name of the group.
|
27
33
|
# @option attributes repository
|
28
34
|
# [Vedeu::Repositories::Repository]
|
29
35
|
# The storage for all Group models.
|
@@ -43,7 +49,7 @@ module Vedeu
|
|
43
49
|
def add(member)
|
44
50
|
attrs = attributes.merge!(members: members.add(member))
|
45
51
|
|
46
|
-
Vedeu::Groups::Group.
|
52
|
+
Vedeu::Groups::Group.store(attrs)
|
47
53
|
end
|
48
54
|
|
49
55
|
# Returns the attributes of the group.
|
@@ -66,6 +72,16 @@ module Vedeu
|
|
66
72
|
interfaces.sort { |a, b| a.zindex <=> b.zindex }.map(&:name)
|
67
73
|
end
|
68
74
|
|
75
|
+
# An object is equal when its values are the same.
|
76
|
+
#
|
77
|
+
# @param other [Vedeu::Groups::Group]
|
78
|
+
# @return [Boolean]
|
79
|
+
def eql?(other)
|
80
|
+
self.class == other.class && name == other.name &&
|
81
|
+
members == other.members
|
82
|
+
end
|
83
|
+
alias_method :==, :eql?
|
84
|
+
|
69
85
|
# Hide the named group of interfaces, or without a name, the
|
70
86
|
# group of the currently focussed interface. Useful for hiding
|
71
87
|
# part of that which is currently displaying in the terminal.
|
@@ -102,7 +118,7 @@ module Vedeu
|
|
102
118
|
def remove(member)
|
103
119
|
attrs = attributes.merge!(members: members.delete(member))
|
104
120
|
|
105
|
-
Vedeu::Groups::Group.
|
121
|
+
Vedeu::Groups::Group.store(attrs)
|
106
122
|
end
|
107
123
|
|
108
124
|
# Remove all members from the group.
|
@@ -111,7 +127,7 @@ module Vedeu
|
|
111
127
|
def reset
|
112
128
|
attrs = defaults.merge!(name: name)
|
113
129
|
|
114
|
-
Vedeu::Groups::Group.
|
130
|
+
Vedeu::Groups::Group.store(attrs)
|
115
131
|
end
|
116
132
|
|
117
133
|
# Show the named group of interfaces, or without a name, the
|
@@ -155,4 +171,12 @@ module Vedeu
|
|
155
171
|
|
156
172
|
end # Groups
|
157
173
|
|
174
|
+
# @!method hide_group
|
175
|
+
# @see Vedeu::Toggleable::ClassMethods#hide
|
176
|
+
# @!method show_group
|
177
|
+
# @see Vedeu::Toggleable::ClassMethods#show
|
178
|
+
# @!method toggle_group
|
179
|
+
# @see Vedeu::Toggleable::ClassMethods#toggle
|
180
|
+
def_delegators Vedeu::Groups::Group, :hide_group, :show_group, :toggle_group
|
181
|
+
|
158
182
|
end # Vedeu
|
data/lib/vedeu/groups/refresh.rb
CHANGED
@@ -16,7 +16,8 @@ module Vedeu
|
|
16
16
|
|
17
17
|
include Vedeu::Common
|
18
18
|
|
19
|
-
# @param name [String] The name of the group to be
|
19
|
+
# @param name [String|Symbol] The name of the group to be
|
20
|
+
# refreshed.
|
20
21
|
# @return [Array|Vedeu::Error::ModelNotFound] A collection of
|
21
22
|
# the names of interfaces refreshed, or an exception when the
|
22
23
|
# group was not found.
|
@@ -26,7 +27,7 @@ module Vedeu
|
|
26
27
|
|
27
28
|
# Return a new instance of Vedeu::Groups::Refresh.
|
28
29
|
#
|
29
|
-
# @param name [String]
|
30
|
+
# @param name [String|Symbol]
|
30
31
|
# @return [Vedeu::Groups::Refresh]
|
31
32
|
def initialize(name)
|
32
33
|
@name = name
|
@@ -21,4 +21,13 @@ module Vedeu
|
|
21
21
|
|
22
22
|
end # Groups
|
23
23
|
|
24
|
+
# Manipulate the repository of groups.
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Vedeu.groups
|
28
|
+
#
|
29
|
+
# @!method groups
|
30
|
+
# @return [Vedeu::Groups::Repository]
|
31
|
+
def_delegators Vedeu::Groups::Repository, :groups
|
32
|
+
|
24
33
|
end # Vedeu
|
data/lib/vedeu/input/capture.rb
CHANGED
data/lib/vedeu/input/keymap.rb
CHANGED
@@ -19,7 +19,8 @@ module Vedeu
|
|
19
19
|
# Returns a new instance of Vedeu::Input::Keymap.
|
20
20
|
#
|
21
21
|
# @param attributes [Hash]
|
22
|
-
# @option attributes name [String] The name of the
|
22
|
+
# @option attributes name [String|Symbol] The name of the
|
23
|
+
# keymap.
|
23
24
|
# @option attributes keys [Vedeu::Input::Keys|Array]
|
24
25
|
# A collection of keys.
|
25
26
|
# @option attributes repository
|
data/lib/vedeu/input/keymaps.rb
CHANGED
data/lib/vedeu/input/mapper.rb
CHANGED
data/lib/vedeu/logging/debug.rb
CHANGED
@@ -13,6 +13,9 @@ module Vedeu
|
|
13
13
|
# Helps to debug a running application by providing a stack
|
14
14
|
# trace of its execution upon exiting.
|
15
15
|
#
|
16
|
+
# @example
|
17
|
+
# Vedeu.debug
|
18
|
+
#
|
16
19
|
# @param filename [String]
|
17
20
|
# @return [void]
|
18
21
|
# @yieldreturn [void] The section of the application to debug.
|
@@ -81,4 +84,14 @@ module Vedeu
|
|
81
84
|
|
82
85
|
end # Logging
|
83
86
|
|
87
|
+
# Allow debugging via the creation of stack traces courtesy of
|
88
|
+
# ruby-prof.
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# Vedeu.debug
|
92
|
+
#
|
93
|
+
# @!method debug
|
94
|
+
# @return [Vedeu::Logging::Debug]
|
95
|
+
def_delegators Vedeu::Logging::Debug, :debug
|
96
|
+
|
84
97
|
end # Vedeu
|
data/lib/vedeu/logging/log.rb
CHANGED
@@ -178,4 +178,12 @@ module Vedeu
|
|
178
178
|
|
179
179
|
end # Logging
|
180
180
|
|
181
|
+
# @!method log
|
182
|
+
# @see Vedeu::Logging::Log.log
|
183
|
+
# @!method log_stdout
|
184
|
+
# @see Vedeu::Logging::Log.log_stdout
|
185
|
+
# @!method log_stderr
|
186
|
+
# @see Vedeu::Logging::Log.log_stderr
|
187
|
+
def_delegators Vedeu::Logging::Log, :log, :log_stdout, :log_stderr
|
188
|
+
|
181
189
|
end # Vedeu
|
data/lib/vedeu/logging/timer.rb
CHANGED
@@ -8,6 +8,8 @@ module Vedeu
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
11
|
+
# Measure the execution time of the code in the given block.
|
12
|
+
#
|
11
13
|
# @example
|
12
14
|
# Vedeu.timer 'message' do
|
13
15
|
# # ... code to be measured
|
@@ -65,4 +67,15 @@ module Vedeu
|
|
65
67
|
|
66
68
|
end # Logging
|
67
69
|
|
70
|
+
# Measure the execution time of the code in the given block.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Vedeu.timer do
|
74
|
+
# # ... some code here ...
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# @!method timer
|
78
|
+
# @see Vedeu::Logging::Timer.timer
|
79
|
+
def_delegators Vedeu::Logging::Timer, :timer
|
80
|
+
|
68
81
|
end # Vedeu
|
data/lib/vedeu/menus/dsl.rb
CHANGED
@@ -9,22 +9,12 @@ module Vedeu
|
|
9
9
|
|
10
10
|
include Vedeu::DSL
|
11
11
|
|
12
|
-
# Return a new instance of Vedeu::Menus::DSL.
|
13
|
-
#
|
14
|
-
# @param model [Vedeu::Menus::Menu]
|
15
|
-
# @param client [Object]
|
16
|
-
# @return [Vedeu::Menus::DSL]
|
17
|
-
def initialize(model, client = nil)
|
18
|
-
@model = model
|
19
|
-
@client = client
|
20
|
-
end
|
21
|
-
|
22
12
|
# Add an individual item to the menu.
|
23
13
|
#
|
24
14
|
# @param element [Object] An object you wish to add to the
|
25
15
|
# collection.
|
26
16
|
#
|
27
|
-
# Vedeu.menu
|
17
|
+
# Vedeu.menu :my_menu do
|
28
18
|
# item SomeClass.new
|
29
19
|
# item SomeClass.new
|
30
20
|
# end
|
@@ -38,14 +28,14 @@ module Vedeu
|
|
38
28
|
# Define the items for the menu. Most powerful when used with
|
39
29
|
# one of your model classes.
|
40
30
|
#
|
41
|
-
# In the
|
31
|
+
# In the :my_playlist example below, your `Track` model may
|
42
32
|
# return a collection of tracks to populate the menu.
|
43
33
|
#
|
44
|
-
# Vedeu.menu
|
34
|
+
# Vedeu.menu :my_menu do
|
45
35
|
# items [:item_1, :item_2, :item_3]
|
46
36
|
# end
|
47
37
|
#
|
48
|
-
# Vedeu.menu
|
38
|
+
# Vedeu.menu :my_playlist do
|
49
39
|
# items Track.all_my_favourites
|
50
40
|
# end
|
51
41
|
#
|
@@ -61,14 +51,14 @@ module Vedeu
|
|
61
51
|
# your application's execution lifetime.
|
62
52
|
#
|
63
53
|
# Vedeu.menu do
|
64
|
-
# name
|
54
|
+
# name :my_menu
|
65
55
|
# # ...
|
66
56
|
# end
|
67
57
|
#
|
68
|
-
# @param
|
58
|
+
# @param name [String|Symbol]
|
69
59
|
# @return [String]
|
70
|
-
def name(
|
71
|
-
model.name =
|
60
|
+
def name(name)
|
61
|
+
model.name = name
|
72
62
|
end
|
73
63
|
alias_method :name=, :name
|
74
64
|
|