vedeu 0.0.25 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -9
- data/Rakefile +0 -10
- data/bin/composition +1 -1
- data/examples/single_interface_app.rb +7 -4
- data/lib/vedeu.rb +19 -48
- data/lib/vedeu/application.rb +8 -7
- data/lib/vedeu/configuration.rb +4 -4
- data/lib/vedeu/input/input.rb +3 -0
- data/lib/vedeu/launcher.rb +3 -0
- data/lib/vedeu/models/background.rb +13 -0
- data/lib/vedeu/models/coercions.rb +21 -0
- data/lib/vedeu/models/colour.rb +22 -0
- data/lib/vedeu/{repository → models}/command.rb +2 -0
- data/lib/vedeu/models/composition.rb +30 -0
- data/lib/vedeu/models/foreground.rb +13 -0
- data/lib/vedeu/models/interface.rb +62 -0
- data/lib/vedeu/models/interface_collection.rb +24 -0
- data/lib/vedeu/models/line.rb +22 -0
- data/lib/vedeu/models/line_collection.rb +27 -0
- data/lib/vedeu/models/presentation.rb +13 -0
- data/lib/vedeu/models/stream.rb +21 -0
- data/lib/vedeu/models/stream_collection.rb +27 -0
- data/lib/vedeu/models/style_collection.rb +23 -0
- data/lib/vedeu/output/interface_renderer.rb +62 -0
- data/lib/vedeu/output/output.rb +6 -5
- data/lib/vedeu/process/process.rb +15 -31
- data/lib/vedeu/repository/command_repository.rb +13 -14
- data/lib/vedeu/repository/interface_repository.rb +12 -13
- data/lib/vedeu/repository/repository.rb +2 -0
- data/lib/vedeu/{output → support}/cursor.rb +2 -0
- data/lib/vedeu/support/esc.rb +112 -0
- data/lib/vedeu/support/events.rb +21 -0
- data/lib/vedeu/support/geometry.rb +66 -0
- data/lib/vedeu/support/parser.rb +27 -0
- data/lib/vedeu/support/terminal.rb +31 -134
- data/lib/vedeu/{output → support}/translator.rb +12 -8
- data/lib/vedeu/{output → support}/wordwrap.rb +2 -4
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application_test.rb +7 -2
- data/test/lib/vedeu/configuration_test.rb +13 -8
- data/test/lib/vedeu/input/input_test.rb +2 -1
- data/test/lib/vedeu/launcher_test.rb +7 -2
- data/test/lib/vedeu/models/background_test.rb +35 -0
- data/test/lib/vedeu/models/colour_test.rb +71 -0
- data/test/lib/vedeu/models/command_test.rb +109 -0
- data/test/lib/vedeu/models/composition_test.rb +187 -0
- data/test/lib/vedeu/models/foreground_test.rb +35 -0
- data/test/lib/vedeu/models/interface_collection_test.rb +57 -0
- data/test/lib/vedeu/models/interface_test.rb +220 -0
- data/test/lib/vedeu/models/line_collection_test.rb +69 -0
- data/test/lib/vedeu/models/line_test.rb +76 -0
- data/test/lib/vedeu/models/presentation_test.rb +8 -0
- data/test/lib/vedeu/models/stream_collection_test.rb +57 -0
- data/test/lib/vedeu/models/stream_test.rb +76 -0
- data/test/lib/vedeu/models/style_collection_test.rb +22 -0
- data/test/lib/vedeu/output/interface_renderer_test.rb +12 -0
- data/test/lib/vedeu/output/output_test.rb +15 -30
- data/test/lib/vedeu/process/process_test.rb +22 -44
- data/test/lib/vedeu/repository/command_repository_test.rb +22 -16
- data/test/lib/vedeu/repository/interface_repository_test.rb +62 -14
- data/test/lib/vedeu/repository/repository_test.rb +1 -0
- data/test/lib/vedeu/repository/storage_test.rb +13 -6
- data/test/lib/vedeu/{output → support}/cursor_test.rb +1 -0
- data/test/lib/vedeu/support/esc_test.rb +348 -0
- data/test/lib/vedeu/support/events_test.rb +37 -0
- data/test/lib/vedeu/support/exit_test.rb +1 -0
- data/test/lib/vedeu/support/geometry_test.rb +131 -0
- data/test/lib/vedeu/support/parser_test.rb +56 -0
- data/test/lib/vedeu/support/queue_test.rb +1 -0
- data/test/lib/vedeu/support/terminal_test.rb +1 -119
- data/test/lib/vedeu/{output → support}/translator_test.rb +17 -12
- data/test/lib/vedeu/{output → support}/wordwrap_test.rb +1 -0
- data/test/lib/vedeu/version_test.rb +1 -0
- data/test/lib/vedeu_test.rb +1 -0
- data/{lib/vedeu/repository → test/support}/dummy_command.rb +0 -0
- data/{lib/vedeu/repository → test/support}/dummy_interface.rb +0 -0
- data/test/support/json/int1_lin1_str1.json +10 -0
- data/test/support/json/int1_lin1_str3.json +18 -0
- data/test/support/json/int1_lin2_str1.json +17 -0
- data/test/support/json/int1_lin2_str3.json +33 -0
- data/test/support/json/int1_lin2_str3_styles.json +43 -0
- data/test/support/json/int2_lin1_str1.json +20 -0
- data/test/support/json/int2_lin1_str3.json +36 -0
- data/test/support/json/int2_lin2_str1.json +34 -0
- data/test/support/json/int2_lin2_str3.json +66 -0
- data/test/support/json/int2_lin2_str3_styles.json +158 -0
- data/test/support/output_1.json +9 -0
- data/test/support/output_1.rb +14 -0
- data/test/support/output_2.json +1 -0
- data/test/support/output_2.rb +19 -0
- data/test/test_helper.rb +0 -2
- data/vedeu.gemspec +0 -3
- metadata +98 -150
- data/config/cucumber.yml +0 -8
- data/documentation/composition.ebnf +0 -7
- data/documentation/diagram/ColourDirective.png +0 -0
- data/documentation/diagram/Directive.png +0 -0
- data/documentation/diagram/Interface.png +0 -0
- data/documentation/diagram/Output.png +0 -0
- data/documentation/diagram/PositionDirective.png +0 -0
- data/documentation/diagram/Stream.png +0 -0
- data/documentation/diagram/StyleDirective.png +0 -0
- data/documentation/diagram/rr-1.35.837.png +0 -0
- data/documentation/index.html +0 -325
- data/features/getting_started.feature +0 -10
- data/features/step_definitions/vedeu_steps.rb +0 -11
- data/features/support/env.rb +0 -12
- data/lib/vedeu/output/background.rb +0 -27
- data/lib/vedeu/output/base.rb +0 -57
- data/lib/vedeu/output/buffer/composition.rb +0 -24
- data/lib/vedeu/output/buffer/formatting.rb +0 -25
- data/lib/vedeu/output/buffer/interface.rb +0 -14
- data/lib/vedeu/output/buffer/line.rb +0 -14
- data/lib/vedeu/output/buffer/stream.rb +0 -14
- data/lib/vedeu/output/buffer/style.rb +0 -11
- data/lib/vedeu/output/colour.rb +0 -39
- data/lib/vedeu/output/compositor.rb +0 -72
- data/lib/vedeu/output/directive.rb +0 -63
- data/lib/vedeu/output/esc.rb +0 -61
- data/lib/vedeu/output/foreground.rb +0 -27
- data/lib/vedeu/output/geometry.rb +0 -71
- data/lib/vedeu/output/layer.rb +0 -9
- data/lib/vedeu/output/menu.rb +0 -26
- data/lib/vedeu/output/position.rb +0 -35
- data/lib/vedeu/output/style.rb +0 -38
- data/lib/vedeu/repository/interface.rb +0 -62
- data/lib/vedeu/support/json_parser.rb +0 -25
- data/lib/vedeu/support/options.rb +0 -4
- data/test/lib/vedeu/output/background_test.rb +0 -67
- data/test/lib/vedeu/output/base_test.rb +0 -8
- data/test/lib/vedeu/output/buffer/composition_test.rb +0 -57
- data/test/lib/vedeu/output/buffer/formatting_test.rb +0 -9
- data/test/lib/vedeu/output/buffer/interface_test.rb +0 -38
- data/test/lib/vedeu/output/buffer/line_test.rb +0 -64
- data/test/lib/vedeu/output/buffer/stream_test.rb +0 -61
- data/test/lib/vedeu/output/buffer/style_test.rb +0 -8
- data/test/lib/vedeu/output/colour_test.rb +0 -104
- data/test/lib/vedeu/output/compositor_test.rb +0 -247
- data/test/lib/vedeu/output/directive_test.rb +0 -82
- data/test/lib/vedeu/output/esc_test.rb +0 -175
- data/test/lib/vedeu/output/foreground_test.rb +0 -67
- data/test/lib/vedeu/output/geometry_test.rb +0 -190
- data/test/lib/vedeu/output/layer_test.rb +0 -35
- data/test/lib/vedeu/output/menu_test.rb +0 -13
- data/test/lib/vedeu/output/position_test.rb +0 -48
- data/test/lib/vedeu/output/style_test.rb +0 -132
- data/test/lib/vedeu/repository/command_test.rb +0 -73
- data/test/lib/vedeu/repository/dummy_command_test.rb +0 -27
- data/test/lib/vedeu/repository/dummy_interface_test.rb +0 -7
- data/test/lib/vedeu/repository/interface_test.rb +0 -79
- data/test/lib/vedeu/support/json_parser_test.rb +0 -45
- data/test/support/composition.json +0 -47
- data/test/support/composition.rb +0 -5
- data/test/support/composition.xml +0 -36
- data/test/support/multi_interface.json +0 -34
- data/test/support/single_interface.json +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f1c1d57417fc05b09722865230c56b1ae0c255f
|
4
|
+
data.tar.gz: bc49bf53438c817107da4b3487f3f3c7d8d65e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64922d74b257a74850aa87cf2455ba58a368060b0d3316f2a14fd3d63b774aaf2017c3ffb11dcdd2934e5f0007661d2c7b252a933a5e1a32ddad7cf761a2a8eb
|
7
|
+
data.tar.gz: 5e3b0890b6121e88a5001e29b6cdf1541e2db0499bfe02f08fecc486bf9347956813394d5e5c7909e4453a0bb9e206a231272933d884afca2690e6a5bc9c1c88
|
data/README.md
CHANGED
@@ -38,17 +38,22 @@ Expect proper documentation soon!
|
|
38
38
|
interface :main, {
|
39
39
|
y: 1,
|
40
40
|
x: 1,
|
41
|
+
z: 1,
|
41
42
|
width: :auto, # will set to terminal width
|
42
43
|
height: 10, # also accepts :auto
|
43
|
-
|
44
|
-
|
44
|
+
colour: {
|
45
|
+
foreground: '#ffffff',
|
46
|
+
background: '#000000'
|
47
|
+
},
|
45
48
|
cursor: false,
|
46
|
-
|
49
|
+
}
|
47
50
|
|
48
51
|
Referring to the above example, interfaces have a name, and various default attributes.
|
49
52
|
|
50
53
|
`:y` sets the starting row point. (See Geometry)
|
51
54
|
`:x` sets the starting column point.
|
55
|
+
`:z` an integer specifying the z-index of the interface.
|
56
|
+
(See Layers)
|
52
57
|
`:width` sets how many characters wide the interface will be.
|
53
58
|
`:height` sets how many characters tall the interface will be.
|
54
59
|
|
@@ -57,8 +62,6 @@ Referring to the above example, interfaces have a name, and various default attr
|
|
57
62
|
|
58
63
|
`:cursor` a boolean specifying whether the cursor should show.
|
59
64
|
|
60
|
-
`:layer` an integer specifying the z-index of the interface.
|
61
|
-
(See Layers)
|
62
65
|
|
63
66
|
### On Defining Commands
|
64
67
|
|
@@ -79,9 +82,7 @@ Geometry for Vedeu, as the same for ANSI terminals, is set top-left, which is po
|
|
79
82
|
|
80
83
|
### Colours
|
81
84
|
|
82
|
-
Vedeu uses
|
83
|
-
|
84
|
-
:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white, :default
|
85
|
+
Vedeu uses HTML/CSS style notation (i.e. '#aadd00').
|
85
86
|
|
86
87
|
|
87
88
|
### Layers
|
@@ -89,7 +90,7 @@ Vedeu uses the standard ANSI terminal colours, though you can also set arbitrary
|
|
89
90
|
Vedeu allows the overlaying of interfaces. To render these correctly,
|
90
91
|
Vedeu uses two rules.
|
91
92
|
|
92
|
-
1) The :
|
93
|
+
1) The :z value. 1 would be default, or bottom. 2 would be placed on top of 1. 3 on top of 2, and so on.
|
93
94
|
2) If two interfaces occupy the same 'space', the interface which was defined last, wins.
|
94
95
|
|
95
96
|
|
data/Rakefile
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
|
-
require 'cucumber'
|
4
|
-
require 'cucumber/rake/task'
|
5
|
-
|
6
|
-
Cucumber::Rake::Task.new(:cucumber) do |t|
|
7
|
-
t.cucumber_opts = "features --format progress"
|
8
|
-
end
|
9
3
|
|
10
4
|
Rake::TestTask.new(:minitest) do |t|
|
11
5
|
t.libs << 'lib/vedeu'
|
@@ -15,7 +9,3 @@ Rake::TestTask.new(:minitest) do |t|
|
|
15
9
|
end
|
16
10
|
|
17
11
|
task default: :minitest
|
18
|
-
|
19
|
-
Rake::Task['minitest'].execute
|
20
|
-
|
21
|
-
Rake::Task['cucumber'].execute
|
data/bin/composition
CHANGED
@@ -8,12 +8,15 @@ class SingleInterfaceApp
|
|
8
8
|
interface :main, {
|
9
9
|
y: 1,
|
10
10
|
x: 1,
|
11
|
+
z: 1,
|
11
12
|
width: :auto,
|
12
13
|
height: :auto,
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
colour: {
|
15
|
+
foreground: '#ffffff',
|
16
|
+
background: '#000000',
|
17
|
+
},
|
18
|
+
cursor: true
|
19
|
+
}
|
17
20
|
|
18
21
|
command :refresh, {
|
19
22
|
entity: SingleInterfaceApp,
|
data/lib/vedeu.rb
CHANGED
@@ -1,59 +1,32 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'logger'
|
3
|
-
require 'io/console'
|
4
|
-
require 'oj'
|
5
|
-
require 'optparse'
|
6
|
-
require 'virtus'
|
7
3
|
|
8
|
-
require_relative 'vedeu/input/input'
|
9
|
-
|
10
|
-
require_relative 'vedeu/support/exit'
|
11
|
-
require_relative 'vedeu/support/json_parser'
|
12
|
-
require_relative 'vedeu/support/queue'
|
13
|
-
require_relative 'vedeu/support/terminal'
|
14
|
-
|
15
|
-
require_relative 'vedeu/output/buffer/style'
|
16
|
-
require_relative 'vedeu/output/buffer/formatting'
|
17
|
-
require_relative 'vedeu/output/buffer/stream'
|
18
|
-
require_relative 'vedeu/output/buffer/line'
|
19
|
-
require_relative 'vedeu/output/buffer/interface'
|
20
|
-
require_relative 'vedeu/output/buffer/composition'
|
21
|
-
|
22
|
-
require_relative 'vedeu/output/base'
|
23
|
-
require_relative 'vedeu/output/background'
|
24
|
-
require_relative 'vedeu/output/compositor'
|
25
|
-
require_relative 'vedeu/output/cursor'
|
26
|
-
require_relative 'vedeu/output/directive'
|
27
|
-
require_relative 'vedeu/output/foreground'
|
28
|
-
require_relative 'vedeu/output/geometry'
|
29
|
-
require_relative 'vedeu/output/layer'
|
30
|
-
require_relative 'vedeu/output/menu'
|
31
|
-
require_relative 'vedeu/output/esc'
|
32
|
-
require_relative 'vedeu/output/colour'
|
33
|
-
require_relative 'vedeu/output/output'
|
34
|
-
require_relative 'vedeu/output/position'
|
35
|
-
require_relative 'vedeu/output/style'
|
36
|
-
require_relative 'vedeu/output/translator'
|
37
|
-
require_relative 'vedeu/output/wordwrap'
|
38
|
-
|
39
|
-
require_relative 'vedeu/process/process'
|
40
|
-
|
41
|
-
require_relative 'vedeu/repository/repository'
|
42
4
|
require_relative 'vedeu/repository/command_repository'
|
43
|
-
require_relative 'vedeu/repository/command'
|
44
5
|
require_relative 'vedeu/repository/interface_repository'
|
45
|
-
require_relative 'vedeu/
|
46
|
-
require_relative 'vedeu/repository/storage'
|
47
|
-
require_relative 'vedeu/repository/dummy_interface'
|
48
|
-
require_relative 'vedeu/repository/dummy_command'
|
49
|
-
|
50
|
-
require_relative 'vedeu/application'
|
51
|
-
require_relative 'vedeu/configuration'
|
6
|
+
require_relative 'vedeu/support/exit'
|
52
7
|
require_relative 'vedeu/launcher'
|
53
8
|
require_relative 'vedeu/version'
|
54
9
|
|
55
10
|
module Vedeu
|
56
11
|
# :nocov:
|
12
|
+
module ClassMethods
|
13
|
+
def command(name, options = {})
|
14
|
+
CommandRepository.create({ name: stringify_symbols(name) }
|
15
|
+
.merge!(options))
|
16
|
+
end
|
17
|
+
|
18
|
+
def interface(name, options = {})
|
19
|
+
InterfaceRepository.create({ name: stringify_symbols(name) }
|
20
|
+
.merge!(options))
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def stringify_symbols(value)
|
26
|
+
value.is_a?(::Symbol) ? value.to_s : value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
57
30
|
def self.logger
|
58
31
|
@logger ||= Logger.new(root_path + '/logs/vedeu.log').tap do |log|
|
59
32
|
log.formatter = proc do |_, time, _, msg|
|
@@ -78,11 +51,9 @@ module Vedeu
|
|
78
51
|
def self.included(receiver)
|
79
52
|
receiver.extend(ClassMethods)
|
80
53
|
end
|
81
|
-
# :nocov:
|
82
54
|
|
83
55
|
private
|
84
56
|
|
85
|
-
# :nocov:
|
86
57
|
def self.root_path
|
87
58
|
File.expand_path('../..', __FILE__)
|
88
59
|
end
|
data/lib/vedeu/application.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
require_relative 'input/input'
|
2
|
+
require_relative 'output/output'
|
3
|
+
require_relative 'process/process'
|
4
|
+
require_relative 'support/terminal'
|
5
|
+
|
1
6
|
module Vedeu
|
2
7
|
class Application
|
3
|
-
|
4
|
-
|
5
|
-
new(options).start
|
6
|
-
end
|
8
|
+
def self.start(options = {})
|
9
|
+
new(options).start
|
7
10
|
end
|
8
11
|
|
9
12
|
def initialize(options = {})
|
@@ -11,13 +14,11 @@ module Vedeu
|
|
11
14
|
end
|
12
15
|
|
13
16
|
def start
|
14
|
-
Terminal.open
|
17
|
+
Terminal.open do
|
15
18
|
Output.render
|
16
19
|
|
17
20
|
runner { main_sequence }
|
18
21
|
end
|
19
|
-
ensure
|
20
|
-
Terminal.close
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
data/lib/vedeu/configuration.rb
CHANGED
data/lib/vedeu/input/input.rb
CHANGED
data/lib/vedeu/launcher.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Vedeu
|
2
|
+
module Coercions
|
3
|
+
private
|
4
|
+
|
5
|
+
def multiple?(values)
|
6
|
+
values.is_a?(::Array)
|
7
|
+
end
|
8
|
+
|
9
|
+
def single?(values)
|
10
|
+
values.is_a?(::Hash)
|
11
|
+
end
|
12
|
+
|
13
|
+
def just_text?(values)
|
14
|
+
values.is_a?(::String)
|
15
|
+
end
|
16
|
+
|
17
|
+
def empty?(values)
|
18
|
+
values.nil? || values.empty?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'oj'
|
2
|
+
require 'virtus'
|
3
|
+
|
4
|
+
require_relative 'foreground'
|
5
|
+
require_relative 'background'
|
6
|
+
|
7
|
+
module Vedeu
|
8
|
+
class Colour
|
9
|
+
include Virtus.model
|
10
|
+
|
11
|
+
attribute :foreground, Foreground
|
12
|
+
attribute :background, Background
|
13
|
+
|
14
|
+
def to_json
|
15
|
+
Oj.dump(attributes, mode: :compat)
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
foreground + background
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'oj'
|
2
|
+
require 'virtus'
|
3
|
+
|
4
|
+
require_relative 'interface_collection'
|
5
|
+
|
6
|
+
module Vedeu
|
7
|
+
class Composition
|
8
|
+
include Virtus.model
|
9
|
+
|
10
|
+
attribute :interfaces, InterfaceCollection
|
11
|
+
|
12
|
+
def self.enqueue(composition)
|
13
|
+
new(composition).enqueue
|
14
|
+
end
|
15
|
+
|
16
|
+
def enqueue
|
17
|
+
interfaces.map do |interface|
|
18
|
+
interface.enqueue(interface.to_s)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_json
|
23
|
+
Oj.dump(attributes, mode: :compat)
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
interfaces.map(&:to_s).join
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'virtus'
|
2
|
+
|
3
|
+
require_relative 'presentation'
|
4
|
+
require_relative 'line_collection'
|
5
|
+
require_relative '../output/interface_renderer'
|
6
|
+
require_relative '../support/esc'
|
7
|
+
require_relative '../support/cursor'
|
8
|
+
require_relative '../support/queue'
|
9
|
+
require_relative '../support/terminal'
|
10
|
+
|
11
|
+
module Vedeu
|
12
|
+
class Interface
|
13
|
+
include Virtus.model
|
14
|
+
include Presentation
|
15
|
+
include Vedeu::Queue
|
16
|
+
|
17
|
+
attribute :name, String
|
18
|
+
attribute :lines, LineCollection
|
19
|
+
attribute :y, Integer, default: 1
|
20
|
+
attribute :x, Integer, default: 1
|
21
|
+
attribute :z, Integer, default: 1
|
22
|
+
attribute :width, Integer, default: Terminal.width
|
23
|
+
attribute :height, Integer, default: Terminal.height
|
24
|
+
attribute :current, String, default: ''
|
25
|
+
attribute :cursor, Boolean, default: true
|
26
|
+
|
27
|
+
def refresh
|
28
|
+
if enqueued?
|
29
|
+
current = dequeue
|
30
|
+
|
31
|
+
elsif no_content?
|
32
|
+
current = clear_interface
|
33
|
+
|
34
|
+
else
|
35
|
+
current
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
Oj.dump(attributes, mode: :compat)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
clear_interface + render_content
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def no_content?
|
51
|
+
current.nil? || current.empty?
|
52
|
+
end
|
53
|
+
|
54
|
+
def render_content
|
55
|
+
InterfaceRenderer.render(self)
|
56
|
+
end
|
57
|
+
|
58
|
+
def clear_interface
|
59
|
+
InterfaceRenderer.clear(self)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|