hokusai-zero 0.1.3 → 0.1.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 +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +4 -0
- data/README.md +2 -0
- data/ast/src/core/hml.c +9 -9
- data/ast/src/core/text.c +1 -3
- data/ast/test/text.c +3 -3
- data/docs.sh +29 -0
- data/ext/extconf.rb +50 -14
- data/grammar/corpus/1_document.txt +24 -0
- data/grammar/corpus/6_styles.txt +23 -0
- data/grammar/grammar.js +4 -4
- data/grammar/src/grammar.json +19 -19
- data/grammar/src/parser.c +1904 -1956
- data/grammar/test.nml +10 -8
- data/hokusai.gemspec +2 -1
- data/ui/examples/assets/Delius-Regular.ttf +0 -0
- data/ui/examples/assets/DoHyeon.ttf +0 -0
- data/ui/examples/assets/Inter-Regular.ttf +0 -0
- data/ui/examples/assets/ernest.gif +0 -0
- data/ui/examples/assets/icons/audio-x-generic.png +0 -0
- data/ui/examples/assets/icons/image-x-generic.png +0 -0
- data/ui/examples/assets/icons/media-playback-pause.png +0 -0
- data/ui/examples/assets/icons/media-playback-start.png +0 -0
- data/ui/examples/assets/icons/media-playback-stop.png +0 -0
- data/ui/examples/assets/icons/package-x-generic.png +0 -0
- data/ui/examples/assets/icons/text-x-generic.png +0 -0
- data/ui/examples/assets/icons/video-x-generic.png +0 -0
- data/ui/examples/buddy.rb +16 -14
- data/ui/examples/clock.rb +38 -36
- data/ui/examples/counter.rb +100 -98
- data/ui/examples/dynamic.rb +115 -113
- data/ui/examples/foobar.rb +189 -187
- data/ui/examples/forum/file.rb +54 -0
- data/ui/examples/forum/music.rb +76 -0
- data/ui/examples/forum/post.rb +146 -0
- data/ui/examples/forum.rb +198 -0
- data/ui/examples/spreadsheet/csv.rb +261 -0
- data/ui/examples/spreadsheet.rb +138 -0
- data/ui/examples/stock.rb +86 -92
- data/ui/examples/stock_decider/option.rb +1 -1
- data/ui/examples/tic_tac_toe.rb +193 -191
- data/ui/lib/lib_hokusai.rb +0 -1
- data/ui/src/hokusai/ast.rb +42 -43
- data/ui/src/hokusai/backends/raylib/font.rb +1 -2
- data/ui/src/hokusai/backends/raylib.rb +16 -7
- data/ui/src/hokusai/backends/sdl2/font.rb +13 -9
- data/ui/src/hokusai/backends/sdl2.rb +5 -5
- data/ui/src/hokusai/block.rb +7 -0
- data/ui/src/hokusai/blocks/hblock.rb +2 -2
- data/ui/src/hokusai/blocks/image.rb +5 -1
- data/ui/src/hokusai/blocks/input.rb +17 -0
- data/ui/src/hokusai/blocks/label.rb +5 -2
- data/ui/src/hokusai/blocks/text.rb +10 -5
- data/ui/src/hokusai/blocks/titlebar/osx.rb +4 -4
- data/ui/src/hokusai/blocks/variable.rb +33 -0
- data/ui/src/hokusai/blocks/vblock.rb +1 -1
- data/ui/src/hokusai/commands/rect.rb +4 -4
- data/ui/src/hokusai/commands.rb +33 -31
- data/ui/src/hokusai/diff.rb +11 -0
- data/ui/src/hokusai/event.rb +19 -5
- data/ui/src/hokusai/events/mouse.rb +9 -1
- data/ui/src/hokusai/font.rb +60 -0
- data/ui/src/hokusai/meta.rb +10 -16
- data/ui/src/hokusai/node.rb +1 -1
- data/ui/src/hokusai/painter.rb +1 -2
- data/ui/src/hokusai/util/clamping_iterator.rb +5 -6
- data/ui/src/hokusai.rb +36 -4
- metadata +37 -3
data/grammar/test.nml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
[template]
|
2
|
-
vblock {
|
3
|
-
...styleSpread
|
4
|
-
}
|
5
|
-
|
6
1
|
[style]
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
mainContainer {
|
3
|
+
int: 38;
|
4
|
+
bool: true;
|
5
|
+
float: 0.3;
|
6
|
+
string: "foobar";
|
7
|
+
func: outline(0, 0, 1, 0);
|
8
|
+
}
|
9
|
+
|
10
|
+
other {
|
11
|
+
bool: false;
|
10
12
|
}
|
data/hokusai.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'hokusai-zero'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.4'
|
4
4
|
s.licenses = ['PPL']
|
5
5
|
s.summary = "A Ruby library for writing GUI applications"
|
6
6
|
s.authors = ["skinnyjames"]
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency "concurrent-ruby", "~> 1.3.4"
|
20
20
|
s.add_dependency "raylib-bindings", "~> 0.7.9"
|
21
21
|
s.add_dependency "sdl2-bindings", "~> 0.2.3"
|
22
|
+
s.add_dependency "memory_profiler"
|
22
23
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/ui/examples/buddy.rb
CHANGED
@@ -2,26 +2,28 @@ require_relative "../src/hokusai"
|
|
2
2
|
require_relative "../src/hokusai/backends/sdl2"
|
3
3
|
require_relative "../src/hokusai/backends/raylib"
|
4
4
|
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
module Demos
|
6
|
+
module Buddy
|
7
|
+
class App < Hokusai::Block
|
8
|
+
template <<~EOF
|
9
|
+
[template]
|
10
|
+
buddy {
|
11
|
+
width="400"
|
12
|
+
height="400"
|
13
|
+
:source="buddy_img"
|
14
|
+
}
|
15
|
+
EOF
|
15
16
|
|
16
|
-
|
17
|
+
uses(buddy: Hokusai::Blocks::Image)
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
def buddy_img
|
20
|
+
"#{__dir__}/assets/science-troll.png"
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
|
-
Hokusai::Backends::RaylibBackend.run(Buddy::App) do |config|
|
26
|
+
Hokusai::Backends::RaylibBackend.run(Demos::Buddy::App) do |config|
|
25
27
|
config.width = 500
|
26
28
|
config.height = 500
|
27
29
|
config.title = "Buddy"
|
data/ui/examples/clock.rb
CHANGED
@@ -5,45 +5,47 @@ require_relative "./tic_tac_toe"
|
|
5
5
|
require_relative "./counter"
|
6
6
|
require "date"
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
time
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
8
|
+
module Demos
|
9
|
+
class Clock < Hokusai::Block
|
10
|
+
template <<~EOF
|
11
|
+
[template]
|
12
|
+
vblock { background="22,22,22" height="50"}
|
13
|
+
label { :content="time" size="30" color="233,233,233" }
|
14
|
+
hblock
|
15
|
+
game { @width="set_width"}
|
16
|
+
[if="fullscreen"]
|
17
|
+
stock
|
18
|
+
EOF
|
19
|
+
|
20
|
+
uses(
|
21
|
+
vblock: Hokusai::Blocks::Vblock,
|
22
|
+
hblock: Hokusai::Blocks::Hblock,
|
23
|
+
empty: Hokusai::Blocks::Empty,
|
24
|
+
label: Hokusai::Blocks::Label,
|
25
|
+
game: TicTacToe::App,
|
26
|
+
stock: Counter
|
27
|
+
)
|
28
|
+
|
29
|
+
attr_accessor :width
|
30
|
+
|
31
|
+
provide :clock_time, :time
|
32
|
+
|
33
|
+
def time
|
34
|
+
time = DateTime.now
|
35
|
+
"#{time.hour}:#{time.minute} #{time.second}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_width(width)
|
39
|
+
@width = width
|
40
|
+
end
|
41
|
+
|
42
|
+
def fullscreen
|
43
|
+
(width || 0) > 500
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
|
-
Hokusai::Backends::SDLBackend.run(Clock) do |config|
|
48
|
+
Hokusai::Backends::SDLBackend.run(Demos::Clock) do |config|
|
47
49
|
config.after_load do
|
48
50
|
# Note: how to load a font...
|
49
51
|
# Thank you to Vladimir Nikolic - https://www.1001fonts.com/users/vladimirnikolic/
|
data/ui/examples/counter.rb
CHANGED
@@ -1,108 +1,110 @@
|
|
1
1
|
require_relative "../src/hokusai"
|
2
2
|
require_relative "../src/hokusai/backends/raylib"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
hblock
|
48
|
-
vblock#add { ...additionStyles }
|
49
|
-
label {
|
50
|
-
content="Add"
|
51
|
-
@click="increment"
|
52
|
-
...additionLabel
|
4
|
+
module Demos
|
5
|
+
class Counter < Hokusai::Block
|
6
|
+
style <<~EOF
|
7
|
+
[style]
|
8
|
+
additionStyles {
|
9
|
+
background: rgb(214, 49, 24);
|
10
|
+
rounding: 0.0;
|
11
|
+
outline: outline(1,4,4,1);
|
12
|
+
outline_color: rgb(216, 26, 137);
|
13
|
+
}
|
14
|
+
|
15
|
+
additionLabel {
|
16
|
+
size: 40;
|
17
|
+
color: rgb(255,255,255);
|
18
|
+
}
|
19
|
+
|
20
|
+
subtractStyles {
|
21
|
+
background: rgb(0, 85, 170);
|
22
|
+
rounding: 0.0;
|
23
|
+
}
|
24
|
+
|
25
|
+
subtractLabel {
|
26
|
+
size: 50;
|
27
|
+
color: rgb(255,255,255);
|
28
|
+
}
|
29
|
+
|
30
|
+
scrollbar {
|
31
|
+
width: 25;
|
32
|
+
control_height: 100;
|
33
|
+
control_padding: 5;
|
34
|
+
control_rounding: 5;
|
35
|
+
}
|
36
|
+
EOF
|
37
|
+
|
38
|
+
template <<-EOF
|
39
|
+
[template]
|
40
|
+
hblock { @keypress="update_keys"}
|
41
|
+
vblock
|
42
|
+
hblock
|
43
|
+
label#count {
|
44
|
+
:content="count"
|
45
|
+
size="130"
|
46
|
+
:color="count_color"
|
53
47
|
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
48
|
+
hblock
|
49
|
+
vblock#add { ...additionStyles }
|
50
|
+
label {
|
51
|
+
content="Add"
|
52
|
+
@click="increment"
|
53
|
+
...additionLabel
|
54
|
+
}
|
55
|
+
vblock#subtract { ...subtractStyles }
|
56
|
+
label {
|
57
|
+
content="Subtract"
|
58
|
+
@click="decrement"
|
59
|
+
...subtractLabel
|
60
|
+
}
|
61
|
+
[if="count_positive"]
|
62
|
+
scrollbar { ...scrollbar }
|
63
|
+
EOF
|
64
|
+
|
65
|
+
uses(
|
66
|
+
vblock: Hokusai::Blocks::Vblock,
|
67
|
+
hblock: Hokusai::Blocks::Hblock,
|
68
|
+
label: Hokusai::Blocks::Label,
|
69
|
+
scrollbar: Hokusai::Blocks::Scrollbar,
|
70
|
+
image: Hokusai::Blocks::Image
|
71
|
+
)
|
72
|
+
|
73
|
+
attr_accessor :count, :keys
|
74
|
+
|
75
|
+
def count_positive
|
76
|
+
count > 0
|
77
|
+
end
|
78
|
+
|
79
|
+
def modal
|
80
|
+
!keys.empty?
|
81
|
+
end
|
82
|
+
|
83
|
+
def update_keys(event)
|
84
|
+
@keys << event.char
|
85
|
+
end
|
86
|
+
|
87
|
+
def increment(event)
|
88
|
+
self.count += 1
|
89
|
+
end
|
90
|
+
|
91
|
+
def decrement(event)
|
92
|
+
self.count -= 1
|
93
|
+
end
|
94
|
+
|
95
|
+
def count_color
|
96
|
+
self.count > 0 ? [0,0,255] : [255,0,0]
|
97
|
+
end
|
98
|
+
|
99
|
+
def initialize(**args)
|
100
|
+
@count = 0
|
101
|
+
@keys = ""
|
102
|
+
super(**args)
|
103
|
+
end
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
105
|
-
Hokusai::Backends::RaylibBackend.run(Counter) do |config|
|
107
|
+
Hokusai::Backends::RaylibBackend.run(Demos::Counter) do |config|
|
106
108
|
# config.after_load do
|
107
109
|
# # Note: how to load a font...
|
108
110
|
# # Thank you to Vladimir Nikolic - https://www.1001fonts.com/users/vladimirnikolic/
|
data/ui/examples/dynamic.rb
CHANGED
@@ -5,134 +5,136 @@ require_relative "../src/hokusai/backends/raylib"
|
|
5
5
|
require_relative "./stock"
|
6
6
|
require_relative "./tic_tac_toe"
|
7
7
|
|
8
|
-
module
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
module Demos
|
9
|
+
module Dynamic
|
10
|
+
class Block < Hokusai::Block
|
11
|
+
template <<~EOF
|
12
|
+
[template]
|
13
|
+
empty
|
14
|
+
EOF
|
14
15
|
|
15
|
-
|
16
|
+
uses(empty: Hokusai::Blocks::Empty)
|
16
17
|
|
17
|
-
|
18
|
+
computed! :script
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
def on_mounted
|
21
|
+
klass = eval(script)
|
21
22
|
|
22
|
-
|
23
|
+
raise Hokusai::Error.new("Class #{klass} is not a Hokusai::Block") unless klass.ancestors.include?(Hokusai::Block)
|
23
24
|
|
24
|
-
|
25
|
+
node.meta.set_child(0, klass.mount)
|
26
|
+
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
appText {
|
36
|
-
content: "Address Lookup";
|
37
|
-
size: 30;
|
38
|
-
color: rgb(222,222,222);
|
39
|
-
}
|
40
|
-
EOF
|
41
|
-
|
42
|
-
template <<~EOF
|
43
|
-
[template]
|
44
|
-
vblock {
|
45
|
-
...mainStyle
|
29
|
+
class App < Hokusai::Block
|
30
|
+
style <<~EOF
|
31
|
+
[style]
|
32
|
+
mainStyle {
|
33
|
+
background: rgb(8, 8, 8);
|
46
34
|
}
|
47
|
-
text { ...appText }
|
48
|
-
variable { :script="script" }
|
49
|
-
EOF
|
50
|
-
|
51
|
-
uses(
|
52
|
-
vblock: Hokusai::Blocks::Vblock,
|
53
|
-
text: Hokusai::Blocks::Text,
|
54
|
-
variable: Dynamic::Block,
|
55
|
-
)
|
56
|
-
|
57
|
-
def script
|
58
|
-
<<~RUBY
|
59
|
-
require "rest-client"
|
60
|
-
require "uri"
|
61
|
-
|
62
|
-
class TestDynamic < Hokusai::Block
|
63
|
-
style <<~EOF
|
64
|
-
[style]
|
65
|
-
inputStyle {
|
66
|
-
background: rgb(18, 18, 18);
|
67
|
-
text_color: rgb(244,244,244);
|
68
|
-
size: 25;
|
69
|
-
height: 80;
|
70
|
-
outline: outline(1,0,1,0);
|
71
|
-
outline_color: rgb(222,222,222);
|
72
|
-
}
|
73
|
-
|
74
|
-
textStyle {
|
75
|
-
color: rgb(225, 228, 224);
|
76
|
-
size: 23;
|
77
|
-
cursor: "manual";
|
78
|
-
padding: padding(5, 20, 0, 20);
|
79
|
-
markdown: true;
|
80
|
-
}
|
81
|
-
|
82
|
-
buttonStyle {
|
83
|
-
size: 20;
|
84
|
-
content: "Open in Maps";
|
85
|
-
}
|
86
|
-
EOF
|
87
|
-
|
88
|
-
template <<~EOF
|
89
|
-
[template]
|
90
|
-
input {
|
91
|
-
...inputStyle
|
92
|
-
@change="geocode"
|
93
|
-
}
|
94
|
-
hblock
|
95
|
-
[if="response"]
|
96
|
-
panel
|
97
|
-
text {
|
98
|
-
...textStyle
|
99
|
-
:content="content"
|
100
|
-
}
|
101
|
-
EOF
|
102
|
-
|
103
|
-
uses(
|
104
|
-
hblock: Hokusai::Blocks::Hblock,
|
105
|
-
text: Hokusai::Blocks::Text,
|
106
|
-
input: Hokusai::Blocks::Input,
|
107
|
-
panel: Hokusai::Blocks::Panel,
|
108
|
-
button: Hokusai::Blocks::Button
|
109
|
-
)
|
110
|
-
|
111
|
-
attr_reader :response
|
112
|
-
|
113
|
-
def geocode(address)
|
114
|
-
uri = "https://geoffrey.skinnyjames.net/api/v1/us/geocode/\#{URI.encode_uri_component(address)}"
|
115
|
-
@response = JSON.parse(RestClient.get(uri).body, symbolize_names: true)
|
116
|
-
end
|
117
35
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
36
|
+
appText {
|
37
|
+
content: "Address Lookup";
|
38
|
+
size: 30;
|
39
|
+
color: rgb(222,222,222);
|
40
|
+
}
|
41
|
+
EOF
|
42
|
+
|
43
|
+
template <<~EOF
|
44
|
+
[template]
|
45
|
+
vblock {
|
46
|
+
...mainStyle
|
47
|
+
}
|
48
|
+
text { ...appText }
|
49
|
+
variable { :script="script" }
|
50
|
+
EOF
|
51
|
+
|
52
|
+
uses(
|
53
|
+
vblock: Hokusai::Blocks::Vblock,
|
54
|
+
text: Hokusai::Blocks::Text,
|
55
|
+
variable: Dynamic::Block,
|
56
|
+
)
|
57
|
+
|
58
|
+
def script
|
59
|
+
<<~RUBY
|
60
|
+
require "rest-client"
|
61
|
+
require "uri"
|
62
|
+
|
63
|
+
class TestDynamic < Hokusai::Block
|
64
|
+
style <<~EOF
|
65
|
+
[style]
|
66
|
+
inputStyle {
|
67
|
+
background: rgb(18, 18, 18);
|
68
|
+
text_color: rgb(244,244,244);
|
69
|
+
size: 25;
|
70
|
+
height: 80;
|
71
|
+
outline: outline(1,0,1,0);
|
72
|
+
outline_color: rgb(222,222,222);
|
73
|
+
}
|
74
|
+
|
75
|
+
textStyle {
|
76
|
+
color: rgb(225, 228, 224);
|
77
|
+
size: 23;
|
78
|
+
cursor: "manual";
|
79
|
+
padding: padding(5, 20, 0, 20);
|
80
|
+
markdown: true;
|
81
|
+
}
|
82
|
+
|
83
|
+
buttonStyle {
|
84
|
+
size: 20;
|
85
|
+
content: "Open in Maps";
|
86
|
+
}
|
87
|
+
EOF
|
88
|
+
|
89
|
+
template <<~EOF
|
90
|
+
[template]
|
91
|
+
input {
|
92
|
+
...inputStyle
|
93
|
+
@change="geocode"
|
94
|
+
}
|
95
|
+
hblock
|
96
|
+
[if="response"]
|
97
|
+
panel
|
98
|
+
text {
|
99
|
+
...textStyle
|
100
|
+
:content="content"
|
101
|
+
}
|
102
|
+
EOF
|
103
|
+
|
104
|
+
uses(
|
105
|
+
hblock: Hokusai::Blocks::Hblock,
|
106
|
+
text: Hokusai::Blocks::Text,
|
107
|
+
input: Hokusai::Blocks::Input,
|
108
|
+
panel: Hokusai::Blocks::Panel,
|
109
|
+
button: Hokusai::Blocks::Button
|
110
|
+
)
|
111
|
+
|
112
|
+
attr_reader :response
|
113
|
+
|
114
|
+
def geocode(address)
|
115
|
+
uri = "https://geoffrey.skinnyjames.net/api/v1/us/geocode/\#{URI.encode_uri_component(address)}"
|
116
|
+
@response = JSON.parse(RestClient.get(uri).body, symbolize_names: true)
|
117
|
+
end
|
118
|
+
|
119
|
+
def content
|
120
|
+
@response&.reduce("") do |memo, payload|
|
121
|
+
link = "https://maps.google.com/maps?q=\#{payload[:latitude]}+\#{payload[:longitude]}"
|
122
|
+
|
123
|
+
memo << "Address: [\#{payload[:address_number]} \#{payload[:street_name]} (\#{payload[:postal_community]}, \#{payload[:state]})](\#{link})\n"
|
124
|
+
memo << " **Latitude:** _\#{payload[:latitude]}_, **Longitude:** _\#{payload[:longitude]}_\n"
|
125
|
+
memo << " [Some link](https://google.com)\n\n"
|
126
|
+
end || "Placeholder"
|
127
|
+
end
|
126
128
|
end
|
127
|
-
end
|
128
129
|
|
129
|
-
|
130
|
-
|
130
|
+
TestDynamic
|
131
|
+
RUBY
|
132
|
+
end
|
131
133
|
end
|
132
134
|
end
|
133
135
|
end
|
134
136
|
|
135
|
-
Hokusai::Backends::SDLBackend.run(Dynamic::App) do |config|
|
137
|
+
Hokusai::Backends::SDLBackend.run(Demos::Dynamic::App) do |config|
|
136
138
|
# backend specific configuration
|
137
139
|
config.width = 600
|
138
140
|
config.height = 500
|