vedeu 0.4.53 → 0.4.54
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 +4 -4
- data/lib/vedeu/api.rb +68 -5
- data/lib/vedeu/bindings/system.rb +0 -15
- data/lib/vedeu/bindings/visibility.rb +57 -13
- data/lib/vedeu/buffers/buffer.rb +5 -56
- data/lib/vedeu/cursor/cursor.rb +24 -16
- data/lib/vedeu/exceptions.rb +1 -1
- data/lib/vedeu/models/group.rb +39 -4
- data/lib/vedeu/models/interface.rb +41 -5
- data/lib/vedeu/null/buffer.rb +5 -0
- data/lib/vedeu/null/interface.rb +15 -0
- data/lib/vedeu/output/all.rb +1 -1
- data/lib/vedeu/output/background.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +0 -2
- data/lib/vedeu/output/{translator.rb → colour_translator.rb} +5 -5
- data/lib/vedeu/output/foreground.rb +1 -1
- data/lib/vedeu/output/render_border.rb +0 -1
- data/lib/vedeu/repositories/model.rb +15 -6
- data/lib/vedeu/repositories/repositories/buffers.rb +6 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +6 -0
- data/lib/vedeu/repositories/repositories/groups.rb +6 -0
- data/lib/vedeu/repositories/repositories/interfaces.rb +6 -0
- data/lib/vedeu/support/all.rb +1 -2
- data/lib/vedeu/support/template.rb +7 -0
- data/lib/vedeu/support/toggleable.rb +98 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/api_test.rb +7 -1
- data/test/lib/vedeu/bindings/system_test.rb +5 -16
- data/test/lib/vedeu/bindings/visibility_test.rb +4 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +9 -91
- data/test/lib/vedeu/cursor/cursor_test.rb +4 -6
- data/test/lib/vedeu/dsl/geometry_test.rb +24 -0
- data/test/lib/vedeu/models/group_test.rb +16 -14
- data/test/lib/vedeu/models/interface_test.rb +1 -1
- data/test/lib/vedeu/null/buffer_test.rb +6 -0
- data/test/lib/vedeu/null/interface_test.rb +18 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +10 -19
- data/test/lib/vedeu/output/{translator_test.rb → colour_translator_test.rb} +5 -5
- data/test/lib/vedeu/support/toggleable_test.rb +69 -0
- data/vedeu.gemspec +1 -1
- metadata +10 -13
- data/lib/vedeu/support/options.rb +0 -70
- data/lib/vedeu/support/visibility.rb +0 -122
- data/test/lib/vedeu/support/options_test.rb +0 -70
- data/test/lib/vedeu/support/visibility_test.rb +0 -95
|
@@ -61,8 +61,8 @@ module Vedeu
|
|
|
61
61
|
it { instance.must_respond_to(:zindex) }
|
|
62
62
|
it { instance.must_respond_to(:zindex=) }
|
|
63
63
|
it { instance.must_respond_to(:visible) }
|
|
64
|
-
it { instance.must_respond_to(:visible?) }
|
|
65
64
|
it { instance.must_respond_to(:visible=) }
|
|
65
|
+
it { instance.must_respond_to(:visible?) }
|
|
66
66
|
it { instance.must_respond_to(:attributes) }
|
|
67
67
|
it { instance.must_respond_to(:lines=) }
|
|
68
68
|
end
|
|
@@ -25,6 +25,12 @@ module Vedeu
|
|
|
25
25
|
it { subject.must_be_instance_of(Hash) }
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
describe '#hide' do
|
|
29
|
+
subject { instance.hide }
|
|
30
|
+
|
|
31
|
+
it { subject.must_be_instance_of(NilClass) }
|
|
32
|
+
end
|
|
33
|
+
|
|
28
34
|
describe '#null?' do
|
|
29
35
|
subject { instance.null? }
|
|
30
36
|
|
|
@@ -37,12 +43,24 @@ module Vedeu
|
|
|
37
43
|
it { subject.must_be_instance_of(NilClass) }
|
|
38
44
|
end
|
|
39
45
|
|
|
46
|
+
describe '#show' do
|
|
47
|
+
subject { instance.show }
|
|
48
|
+
|
|
49
|
+
it { subject.must_be_instance_of(NilClass) }
|
|
50
|
+
end
|
|
51
|
+
|
|
40
52
|
describe '#store' do
|
|
41
53
|
subject { instance.store }
|
|
42
54
|
|
|
43
55
|
it { subject.must_be_instance_of(Vedeu::Null::Interface) }
|
|
44
56
|
end
|
|
45
57
|
|
|
58
|
+
describe '#toggle' do
|
|
59
|
+
subject { instance.toggle }
|
|
60
|
+
|
|
61
|
+
it { subject.must_be_instance_of(NilClass) }
|
|
62
|
+
end
|
|
63
|
+
|
|
46
64
|
describe '#visible?' do
|
|
47
65
|
subject { instance.visible? }
|
|
48
66
|
|
|
@@ -35,30 +35,21 @@ module Vedeu
|
|
|
35
35
|
|
|
36
36
|
subject { instance.render }
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
let(:output) {
|
|
39
|
+
[
|
|
40
40
|
[
|
|
41
|
-
[
|
|
42
|
-
|
|
43
|
-
Vedeu::Char.new(value: ' ', position: [1, 2]),
|
|
41
|
+
Vedeu::Char.new(value: ' ', position: [1, 1]),
|
|
42
|
+
Vedeu::Char.new(value: ' ', position: [1, 2]),
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
], [
|
|
45
|
+
Vedeu::Char.new(value: ' ', position: [2, 1]),
|
|
46
|
+
Vedeu::Char.new(value: ' ', position: [2, 2]),
|
|
48
47
|
|
|
49
|
-
]
|
|
50
48
|
]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
it { subject.must_equal(output) }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context 'when the interface is not visible' do
|
|
57
|
-
let(:visible) { false }
|
|
58
|
-
|
|
59
|
-
it { subject.must_equal([]) }
|
|
60
|
-
end
|
|
49
|
+
]
|
|
50
|
+
}
|
|
61
51
|
|
|
52
|
+
it { subject.must_equal(output) }
|
|
62
53
|
end
|
|
63
54
|
|
|
64
55
|
end # NamedInterface
|
|
@@ -2,9 +2,9 @@ require 'test_helper'
|
|
|
2
2
|
|
|
3
3
|
module Vedeu
|
|
4
4
|
|
|
5
|
-
describe
|
|
5
|
+
describe ColourTranslator do
|
|
6
6
|
|
|
7
|
-
let(:described) { Vedeu::
|
|
7
|
+
let(:described) { Vedeu::ColourTranslator }
|
|
8
8
|
let(:instance) { described.new(colour) }
|
|
9
9
|
let(:colour) { '#ff0000' }
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ module Vedeu
|
|
|
27
27
|
subject { described.coerce(_value) }
|
|
28
28
|
|
|
29
29
|
context 'when the value is nil' do
|
|
30
|
-
it { subject.must_be_instance_of(Vedeu::
|
|
30
|
+
it { subject.must_be_instance_of(Vedeu::ColourTranslator) }
|
|
31
31
|
|
|
32
32
|
it {
|
|
33
33
|
Vedeu::Background.coerce(_value).
|
|
@@ -56,7 +56,7 @@ module Vedeu
|
|
|
56
56
|
context 'when the value is not a polymorphic Colour' do
|
|
57
57
|
let(:_value) { '#aadd00' }
|
|
58
58
|
|
|
59
|
-
it { subject.must_be_instance_of(Vedeu::
|
|
59
|
+
it { subject.must_be_instance_of(Vedeu::ColourTranslator) }
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -151,6 +151,6 @@ module Vedeu
|
|
|
151
151
|
end
|
|
152
152
|
end
|
|
153
153
|
|
|
154
|
-
end #
|
|
154
|
+
end # ColourTranslator
|
|
155
155
|
|
|
156
156
|
end # Vedeu
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module Vedeu
|
|
4
|
+
|
|
5
|
+
class ToggleableTestClass
|
|
6
|
+
include Vedeu::Toggleable
|
|
7
|
+
|
|
8
|
+
def initialize(boolean)
|
|
9
|
+
@visible = boolean
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def store
|
|
13
|
+
self
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe Toggleable do
|
|
18
|
+
|
|
19
|
+
let(:described) { Vedeu::Toggleable }
|
|
20
|
+
let(:instance) { Vedeu::ToggleableTestClass.new(visible) }
|
|
21
|
+
let(:visible) { false }
|
|
22
|
+
|
|
23
|
+
describe 'accessors' do
|
|
24
|
+
it { instance.must_respond_to(:visible) }
|
|
25
|
+
it { instance.must_respond_to(:visible=) }
|
|
26
|
+
it { instance.must_respond_to(:visible?) }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#hide' do
|
|
30
|
+
subject { instance.hide }
|
|
31
|
+
|
|
32
|
+
it {
|
|
33
|
+
subject
|
|
34
|
+
instance.instance_variable_get('@visible').must_equal(false)
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe '#show' do
|
|
39
|
+
subject { instance.show }
|
|
40
|
+
|
|
41
|
+
it {
|
|
42
|
+
subject
|
|
43
|
+
instance.instance_variable_get('@visible').must_equal(true)
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe '#toggle' do
|
|
48
|
+
subject { instance.toggle }
|
|
49
|
+
|
|
50
|
+
context 'when the model is visible' do
|
|
51
|
+
let(:visible) { true }
|
|
52
|
+
|
|
53
|
+
it {
|
|
54
|
+
subject
|
|
55
|
+
instance.instance_variable_get('@visible').must_equal(false)
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context 'when the model is not visible' do
|
|
60
|
+
it {
|
|
61
|
+
subject
|
|
62
|
+
instance.instance_variable_get('@visible').must_equal(true)
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end # Toggleable
|
|
68
|
+
|
|
69
|
+
end # Vedeu
|
data/vedeu.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_development_dependency 'guard', '2.12.8'
|
|
24
24
|
spec.add_development_dependency 'guard-minitest', '2.4.4'
|
|
25
25
|
spec.add_development_dependency 'minitest', '5.7.0'
|
|
26
|
-
spec.add_development_dependency 'minitest-reporters', '1.0.
|
|
26
|
+
spec.add_development_dependency 'minitest-reporters', '1.0.19'
|
|
27
27
|
spec.add_development_dependency 'mocha', '1.1.0'
|
|
28
28
|
spec.add_development_dependency 'pry', '0.10.1'
|
|
29
29
|
spec.add_development_dependency 'rubocop', '0.32.1'
|
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.4.
|
|
4
|
+
version: 0.4.54
|
|
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-07-
|
|
11
|
+
date: 2015-07-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: guard
|
|
@@ -58,14 +58,14 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - '='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 1.0.
|
|
61
|
+
version: 1.0.19
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - '='
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 1.0.
|
|
68
|
+
version: 1.0.19
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: mocha
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -390,6 +390,7 @@ files:
|
|
|
390
390
|
- lib/vedeu/output/clear/named_group.rb
|
|
391
391
|
- lib/vedeu/output/clear/named_interface.rb
|
|
392
392
|
- lib/vedeu/output/colour.rb
|
|
393
|
+
- lib/vedeu/output/colour_translator.rb
|
|
393
394
|
- lib/vedeu/output/compressor.rb
|
|
394
395
|
- lib/vedeu/output/esc.rb
|
|
395
396
|
- lib/vedeu/output/foreground.rb
|
|
@@ -411,7 +412,6 @@ files:
|
|
|
411
412
|
- lib/vedeu/output/style.rb
|
|
412
413
|
- lib/vedeu/output/templates/html_renderer.vedeu
|
|
413
414
|
- lib/vedeu/output/text.rb
|
|
414
|
-
- lib/vedeu/output/translator.rb
|
|
415
415
|
- lib/vedeu/output/view_helpers/all.rb
|
|
416
416
|
- lib/vedeu/output/view_helpers/view_helpers.rb
|
|
417
417
|
- lib/vedeu/output/viewport.rb
|
|
@@ -441,11 +441,10 @@ files:
|
|
|
441
441
|
- lib/vedeu/support/all.rb
|
|
442
442
|
- lib/vedeu/support/common.rb
|
|
443
443
|
- lib/vedeu/support/log.rb
|
|
444
|
-
- lib/vedeu/support/options.rb
|
|
445
444
|
- lib/vedeu/support/template.rb
|
|
446
445
|
- lib/vedeu/support/terminal.rb
|
|
447
446
|
- lib/vedeu/support/timer.rb
|
|
448
|
-
- lib/vedeu/support/
|
|
447
|
+
- lib/vedeu/support/toggleable.rb
|
|
449
448
|
- lib/vedeu/templating/all.rb
|
|
450
449
|
- lib/vedeu/templating/directive.rb
|
|
451
450
|
- lib/vedeu/templating/helpers.rb
|
|
@@ -535,6 +534,7 @@ files:
|
|
|
535
534
|
- test/lib/vedeu/output/clear/named_group_test.rb
|
|
536
535
|
- test/lib/vedeu/output/clear/named_interface_test.rb
|
|
537
536
|
- test/lib/vedeu/output/colour_test.rb
|
|
537
|
+
- test/lib/vedeu/output/colour_translator_test.rb
|
|
538
538
|
- test/lib/vedeu/output/compressor_test.rb
|
|
539
539
|
- test/lib/vedeu/output/esc_test.rb
|
|
540
540
|
- test/lib/vedeu/output/foreground_test.rb
|
|
@@ -555,7 +555,6 @@ files:
|
|
|
555
555
|
- test/lib/vedeu/output/renderers/text_test.rb
|
|
556
556
|
- test/lib/vedeu/output/style_test.rb
|
|
557
557
|
- test/lib/vedeu/output/text_test.rb
|
|
558
|
-
- test/lib/vedeu/output/translator_test.rb
|
|
559
558
|
- test/lib/vedeu/output/view_helpers/view_helpers_test.rb
|
|
560
559
|
- test/lib/vedeu/output/viewport_test.rb
|
|
561
560
|
- test/lib/vedeu/output/virtual_buffer_test.rb
|
|
@@ -581,11 +580,10 @@ files:
|
|
|
581
580
|
- test/lib/vedeu/repositories/store_test.rb
|
|
582
581
|
- test/lib/vedeu/support/common_test.rb
|
|
583
582
|
- test/lib/vedeu/support/log_test.rb
|
|
584
|
-
- test/lib/vedeu/support/options_test.rb
|
|
585
583
|
- test/lib/vedeu/support/template_test.rb
|
|
586
584
|
- test/lib/vedeu/support/terminal_test.rb
|
|
587
585
|
- test/lib/vedeu/support/timer_test.rb
|
|
588
|
-
- test/lib/vedeu/support/
|
|
586
|
+
- test/lib/vedeu/support/toggleable_test.rb
|
|
589
587
|
- test/lib/vedeu/templating/directive_test.rb
|
|
590
588
|
- test/lib/vedeu/templating/helpers_test.rb
|
|
591
589
|
- test/lib/vedeu/templating/preprocessor_test.rb
|
|
@@ -705,6 +703,7 @@ test_files:
|
|
|
705
703
|
- test/lib/vedeu/output/clear/named_group_test.rb
|
|
706
704
|
- test/lib/vedeu/output/clear/named_interface_test.rb
|
|
707
705
|
- test/lib/vedeu/output/colour_test.rb
|
|
706
|
+
- test/lib/vedeu/output/colour_translator_test.rb
|
|
708
707
|
- test/lib/vedeu/output/compressor_test.rb
|
|
709
708
|
- test/lib/vedeu/output/esc_test.rb
|
|
710
709
|
- test/lib/vedeu/output/foreground_test.rb
|
|
@@ -725,7 +724,6 @@ test_files:
|
|
|
725
724
|
- test/lib/vedeu/output/renderers/text_test.rb
|
|
726
725
|
- test/lib/vedeu/output/style_test.rb
|
|
727
726
|
- test/lib/vedeu/output/text_test.rb
|
|
728
|
-
- test/lib/vedeu/output/translator_test.rb
|
|
729
727
|
- test/lib/vedeu/output/view_helpers/view_helpers_test.rb
|
|
730
728
|
- test/lib/vedeu/output/viewport_test.rb
|
|
731
729
|
- test/lib/vedeu/output/virtual_buffer_test.rb
|
|
@@ -751,11 +749,10 @@ test_files:
|
|
|
751
749
|
- test/lib/vedeu/repositories/store_test.rb
|
|
752
750
|
- test/lib/vedeu/support/common_test.rb
|
|
753
751
|
- test/lib/vedeu/support/log_test.rb
|
|
754
|
-
- test/lib/vedeu/support/options_test.rb
|
|
755
752
|
- test/lib/vedeu/support/template_test.rb
|
|
756
753
|
- test/lib/vedeu/support/terminal_test.rb
|
|
757
754
|
- test/lib/vedeu/support/timer_test.rb
|
|
758
|
-
- test/lib/vedeu/support/
|
|
755
|
+
- test/lib/vedeu/support/toggleable_test.rb
|
|
759
756
|
- test/lib/vedeu/templating/directive_test.rb
|
|
760
757
|
- test/lib/vedeu/templating/helpers_test.rb
|
|
761
758
|
- test/lib/vedeu/templating/preprocessor_test.rb
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
module Vedeu
|
|
2
|
-
|
|
3
|
-
# Converts an options Hash into a class containing methods for each of the
|
|
4
|
-
# keys, which when called returns the value associated. When the value is
|
|
5
|
-
# either true or false, an additional predicate method is created.
|
|
6
|
-
#
|
|
7
|
-
# @api private
|
|
8
|
-
class Options
|
|
9
|
-
|
|
10
|
-
# @!attribute [r] _defined
|
|
11
|
-
# @return [Array<Symbol>]
|
|
12
|
-
attr_reader :_defined
|
|
13
|
-
|
|
14
|
-
# @param options [Hash]
|
|
15
|
-
# @return [Vedeu::Options]
|
|
16
|
-
def self.build(options = {})
|
|
17
|
-
new(options)._build
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Returns a new instance of Vedeu::Options.
|
|
21
|
-
#
|
|
22
|
-
# @param options [Hash]
|
|
23
|
-
# @return [Vedeu::Options]
|
|
24
|
-
def initialize(options = {})
|
|
25
|
-
@_options = options
|
|
26
|
-
@_defined = []
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# @return [Vedeu::Options]
|
|
30
|
-
def _build
|
|
31
|
-
_options.each do |name, value|
|
|
32
|
-
_create_method(name) { value }
|
|
33
|
-
|
|
34
|
-
if value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
|
35
|
-
_create_alias("#{name}?", name)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
self
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
protected
|
|
43
|
-
|
|
44
|
-
# @!attribute [r] _options
|
|
45
|
-
# @return [Hash]
|
|
46
|
-
attr_reader :_options
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
# @param alias_name [String|Symbol]
|
|
51
|
-
# @param method_name [String|Symbol]
|
|
52
|
-
# @return [void]
|
|
53
|
-
def _create_alias(alias_name, method_name)
|
|
54
|
-
@_defined << alias_name.to_sym
|
|
55
|
-
|
|
56
|
-
define_singleton_method(alias_name, method(method_name))
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# @param name [String|Symbol]
|
|
60
|
-
# @param block [Proc]
|
|
61
|
-
# @return [void]
|
|
62
|
-
def _create_method(name, &block)
|
|
63
|
-
@_defined << name.to_sym
|
|
64
|
-
|
|
65
|
-
self.class.send(:define_method, name, &block)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end # Option
|
|
69
|
-
|
|
70
|
-
end # Vedeu
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
module Vedeu
|
|
2
|
-
|
|
3
|
-
# Change the visibility of the given model.
|
|
4
|
-
#
|
|
5
|
-
# @api private
|
|
6
|
-
class Visibility
|
|
7
|
-
|
|
8
|
-
# Hide a named cursor, or without a name, the cursor of the currently
|
|
9
|
-
# focussed interface.
|
|
10
|
-
#
|
|
11
|
-
# @example
|
|
12
|
-
# Vedeu.hide_cursor(name)
|
|
13
|
-
#
|
|
14
|
-
# @param name [String]
|
|
15
|
-
# @return [Vedeu::Visibility]
|
|
16
|
-
def self.hide_cursor(name = nil)
|
|
17
|
-
model = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
|
|
18
|
-
|
|
19
|
-
new(model).hide
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Show a named cursor, or without a name, the cursor of the currently
|
|
23
|
-
# focussed interface.
|
|
24
|
-
#
|
|
25
|
-
# @example
|
|
26
|
-
# Vedeu.show_cursor(name)
|
|
27
|
-
#
|
|
28
|
-
# @param name [String]
|
|
29
|
-
# @return [Vedeu::Visibility]
|
|
30
|
-
def self.show_cursor(name = nil)
|
|
31
|
-
model = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
|
|
32
|
-
|
|
33
|
-
new(model).show
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Show the given model.
|
|
37
|
-
#
|
|
38
|
-
# @param model [void]
|
|
39
|
-
# @return [void]
|
|
40
|
-
def self.show(model)
|
|
41
|
-
new(model).show
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# Hide the given model.
|
|
45
|
-
#
|
|
46
|
-
# @param model [void]
|
|
47
|
-
# @return [void]
|
|
48
|
-
def self.hide(model)
|
|
49
|
-
new(model).hide
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Toggle the visibility of the given model.
|
|
53
|
-
#
|
|
54
|
-
# @param model [void]
|
|
55
|
-
# @return [void]
|
|
56
|
-
def self.toggle(model)
|
|
57
|
-
new(model).toggle
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# Returns a new instance of Vedeu::Visibility.
|
|
61
|
-
#
|
|
62
|
-
# @param model [void]
|
|
63
|
-
# @return [Vedeu::Visibility]
|
|
64
|
-
def initialize(model)
|
|
65
|
-
@model = model
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# @return [void]
|
|
69
|
-
def show
|
|
70
|
-
if model.visible?
|
|
71
|
-
model
|
|
72
|
-
|
|
73
|
-
else
|
|
74
|
-
model.visible = true
|
|
75
|
-
model.store
|
|
76
|
-
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# @return [Symbol]
|
|
81
|
-
def state
|
|
82
|
-
if model.visible?
|
|
83
|
-
:visible
|
|
84
|
-
|
|
85
|
-
else
|
|
86
|
-
:invisible
|
|
87
|
-
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# @return [void]
|
|
92
|
-
def hide
|
|
93
|
-
if model.visible?
|
|
94
|
-
model.visible = false
|
|
95
|
-
model.store
|
|
96
|
-
|
|
97
|
-
else
|
|
98
|
-
model
|
|
99
|
-
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# @return [void]
|
|
104
|
-
def toggle
|
|
105
|
-
if model.visible?
|
|
106
|
-
hide
|
|
107
|
-
|
|
108
|
-
else
|
|
109
|
-
show
|
|
110
|
-
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
protected
|
|
115
|
-
|
|
116
|
-
# @!attribute [r] model
|
|
117
|
-
# @return [void]
|
|
118
|
-
attr_reader :model
|
|
119
|
-
|
|
120
|
-
end # Visibility
|
|
121
|
-
|
|
122
|
-
end # Vedeu
|