gloo-lang 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/args.rb +3 -2
- data/lib/gloo_lang/app/engine.rb +23 -23
- data/lib/gloo_lang/app/help.rb +10 -9
- data/lib/gloo_lang/app/log.rb +5 -3
- data/lib/gloo_lang/app/settings.rb +10 -9
- data/lib/gloo_lang/convert/converter.rb +9 -2
- data/lib/gloo_lang/core/baseo.rb +2 -1
- data/lib/gloo_lang/core/dictionary.rb +16 -6
- data/lib/gloo_lang/core/event_manager.rb +9 -8
- data/lib/gloo_lang/core/factory.rb +11 -10
- data/lib/gloo_lang/core/gloo_system.rb +9 -8
- data/lib/gloo_lang/core/heap.rb +5 -4
- data/lib/gloo_lang/core/here.rb +2 -2
- data/lib/gloo_lang/core/obj.rb +9 -8
- data/lib/gloo_lang/core/obj_finder.rb +3 -3
- data/lib/gloo_lang/core/parser.rb +6 -5
- data/lib/gloo_lang/core/pn.rb +20 -16
- data/lib/gloo_lang/core/verb.rb +2 -1
- data/lib/gloo_lang/exec/dispatch.rb +8 -8
- data/lib/gloo_lang/exec/exec_env.rb +7 -6
- data/lib/gloo_lang/exec/runner.rb +10 -10
- data/lib/gloo_lang/exec/script.rb +6 -5
- data/lib/gloo_lang/exec/stack.rb +8 -7
- data/lib/gloo_lang/expr/expression.rb +3 -2
- data/lib/gloo_lang/objs/basic/alias.rb +4 -4
- data/lib/gloo_lang/objs/basic/boolean.rb +3 -3
- data/lib/gloo_lang/objs/basic/container.rb +2 -2
- data/lib/gloo_lang/objs/basic/decimal.rb +3 -3
- data/lib/gloo_lang/objs/basic/integer.rb +3 -3
- data/lib/gloo_lang/objs/basic/script.rb +1 -1
- data/lib/gloo_lang/objs/basic/string.rb +3 -3
- data/lib/gloo_lang/objs/basic/text.rb +2 -2
- data/lib/gloo_lang/objs/ctrl/each.rb +3 -3
- data/lib/gloo_lang/objs/ctrl/repeat.rb +2 -2
- data/lib/gloo_lang/objs/data/markdown.rb +2 -2
- data/lib/gloo_lang/objs/data/query.rb +4 -4
- data/lib/gloo_lang/objs/data/table.rb +3 -3
- data/lib/gloo_lang/objs/dt/date.rb +1 -1
- data/lib/gloo_lang/objs/dt/datetime.rb +2 -2
- data/lib/gloo_lang/objs/dt/time.rb +1 -1
- data/lib/gloo_lang/objs/ror/erb.rb +2 -2
- data/lib/gloo_lang/objs/ror/eval.rb +3 -3
- data/lib/gloo_lang/objs/web/http_get.rb +3 -3
- data/lib/gloo_lang/objs/web/http_post.rb +8 -8
- data/lib/gloo_lang/objs/web/json.rb +5 -5
- data/lib/gloo_lang/objs/web/slack.rb +1 -1
- data/lib/gloo_lang/objs/web/teams.rb +1 -1
- data/lib/gloo_lang/objs/web/uri.rb +6 -6
- data/lib/gloo_lang/persist/file_loader.rb +6 -5
- data/lib/gloo_lang/persist/file_saver.rb +2 -1
- data/lib/gloo_lang/persist/file_storage.rb +6 -5
- data/lib/gloo_lang/persist/persist_man.rb +9 -8
- data/lib/gloo_lang/utils/stats.rb +5 -4
- data/lib/gloo_lang/verbs/context.rb +4 -4
- data/lib/gloo_lang/verbs/create.rb +3 -3
- data/lib/gloo_lang/verbs/execute.rb +4 -4
- data/lib/gloo_lang/verbs/help.rb +23 -23
- data/lib/gloo_lang/verbs/if.rb +3 -3
- data/lib/gloo_lang/verbs/list.rb +7 -7
- data/lib/gloo_lang/verbs/load.rb +3 -3
- data/lib/gloo_lang/verbs/move.rb +6 -6
- data/lib/gloo_lang/verbs/put.rb +6 -6
- data/lib/gloo_lang/verbs/quit.rb +1 -1
- data/lib/gloo_lang/verbs/run.rb +5 -5
- data/lib/gloo_lang/verbs/save.rb +1 -1
- data/lib/gloo_lang/verbs/show.rb +5 -5
- data/lib/gloo_lang/verbs/tell.rb +5 -4
- data/lib/gloo_lang/verbs/unless.rb +3 -3
- data/lib/gloo_lang/verbs/version.rb +1 -1
- data/lib/gloo_lang/verbs/wait.rb +1 -1
- metadata +2 -2
data/lib/gloo_lang/core/pn.rb
CHANGED
@@ -19,29 +19,30 @@ module GlooLang
|
|
19
19
|
# Set up the object given a source string,
|
20
20
|
# ie: the full path and name.
|
21
21
|
#
|
22
|
-
def initialize( src )
|
22
|
+
def initialize( engine, src )
|
23
|
+
@engine = engine
|
23
24
|
set_to src
|
24
25
|
end
|
25
26
|
|
26
27
|
#
|
27
28
|
# Reference to the root object path.
|
28
29
|
#
|
29
|
-
def self.root
|
30
|
-
return Pn.new( ROOT )
|
30
|
+
def self.root( engine )
|
31
|
+
return Pn.new( engine, ROOT )
|
31
32
|
end
|
32
33
|
|
33
34
|
#
|
34
35
|
# Reference to it.
|
35
36
|
#
|
36
|
-
def self.it
|
37
|
-
return Pn.new( IT )
|
37
|
+
def self.it( engine )
|
38
|
+
return Pn.new( engine, IT )
|
38
39
|
end
|
39
40
|
|
40
41
|
#
|
41
42
|
# Reference to the error message.
|
42
43
|
#
|
43
|
-
def self.error
|
44
|
-
return Pn.new( ERROR )
|
44
|
+
def self.error( engine )
|
45
|
+
return Pn.new( engine, ERROR )
|
45
46
|
end
|
46
47
|
|
47
48
|
#
|
@@ -127,13 +128,13 @@ module GlooLang
|
|
127
128
|
# Get the parent that contains the object referenced.
|
128
129
|
#
|
129
130
|
def get_parent
|
130
|
-
o =
|
131
|
+
o = @engine.heap.root
|
131
132
|
|
132
133
|
if self.includes_path?
|
133
134
|
@elements[ 0..-2 ].each do |e|
|
134
135
|
o = o.find_child( e )
|
135
136
|
if o.nil?
|
136
|
-
|
137
|
+
@engine.log.error "Object '#{e}' was not found."
|
137
138
|
return nil
|
138
139
|
end
|
139
140
|
end
|
@@ -169,18 +170,21 @@ module GlooLang
|
|
169
170
|
# Find the object referenced or return nil if it is not found.
|
170
171
|
#
|
171
172
|
def resolve
|
172
|
-
return
|
173
|
-
return
|
174
|
-
return
|
175
|
-
return GlooLang::Core::GlooSystem.new(
|
176
|
-
|
177
|
-
|
173
|
+
return @engine.heap.root if self.root?
|
174
|
+
return @engine.heap.it if self.it?
|
175
|
+
return @engine.heap.error if self.error?
|
176
|
+
return GlooLang::Core::GlooSystem.new(
|
177
|
+
@engine, self ) if self.gloo_sys?
|
178
|
+
|
179
|
+
if Here.includes_here_ref?( @elements )
|
180
|
+
Here.expand_here( @engine, self )
|
181
|
+
end
|
178
182
|
|
179
183
|
parent = self.get_parent
|
180
184
|
return nil unless parent
|
181
185
|
|
182
186
|
obj = parent.find_child( self.name )
|
183
|
-
return GlooLang::Objs::Alias.resolve_alias( obj, self.src )
|
187
|
+
return GlooLang::Objs::Alias.resolve_alias( @engine, obj, self.src )
|
184
188
|
end
|
185
189
|
|
186
190
|
end
|
data/lib/gloo_lang/core/verb.rb
CHANGED
@@ -15,24 +15,24 @@ module GlooLang
|
|
15
15
|
#
|
16
16
|
# Dispatch the given message to the given object.
|
17
17
|
#
|
18
|
-
def self.message( msg, to_obj, params = nil )
|
19
|
-
|
18
|
+
def self.message( engine, msg, to_obj, params = nil )
|
19
|
+
engine.log.debug "Dispatch message #{msg} to #{to_obj.name}"
|
20
20
|
a = GlooLang::Exec::Action.new msg, to_obj, params
|
21
|
-
GlooLang::Exec::Dispatch.action a
|
21
|
+
GlooLang::Exec::Dispatch.action( engine, a )
|
22
22
|
end
|
23
23
|
|
24
24
|
#
|
25
25
|
# Dispatch an action.
|
26
26
|
#
|
27
|
-
def self.action( action )
|
27
|
+
def self.action( engine, action )
|
28
28
|
unless action.valid?
|
29
|
-
|
29
|
+
engine.log.warn "Object #{action.to.name} does not respond to #{action.msg}"
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
engine.exec_env.push_action action
|
33
|
+
engine.log.debug "Sending message #{action.msg} to #{action.to.name}"
|
34
34
|
action.dispatch
|
35
|
-
|
35
|
+
engine.exec_env.pop_action
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -19,13 +19,14 @@ module GlooLang
|
|
19
19
|
#
|
20
20
|
# Set up the execution environment.
|
21
21
|
#
|
22
|
-
def initialize
|
23
|
-
|
22
|
+
def initialize( engine )
|
23
|
+
@engine = engine
|
24
|
+
@engine.log.debug 'exec env intialized...'
|
24
25
|
|
25
|
-
@verbs = GlooLang::Exec::Stack.new VERB_STACK
|
26
|
-
@actions = GlooLang::Exec::Stack.new ACTION_STACK
|
27
|
-
@scripts = GlooLang::Exec::Stack.new SCRIPT_STACK
|
28
|
-
@here = GlooLang::Exec::Stack.new HERE_STACK
|
26
|
+
@verbs = GlooLang::Exec::Stack.new( @engine, VERB_STACK )
|
27
|
+
@actions = GlooLang::Exec::Stack.new( @engine, ACTION_STACK )
|
28
|
+
@scripts = GlooLang::Exec::Stack.new( @engine, SCRIPT_STACK )
|
29
|
+
@here = GlooLang::Exec::Stack.new( @engine, HERE_STACK )
|
29
30
|
end
|
30
31
|
|
31
32
|
#
|
@@ -15,28 +15,28 @@ module GlooLang
|
|
15
15
|
# that need to be done before or after a verb
|
16
16
|
# is done running.
|
17
17
|
#
|
18
|
-
def self.go( verb )
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
def self.go( engine, verb )
|
19
|
+
engine.log.debug "running verb #{verb.type_display}"
|
20
|
+
engine.heap.error.start_tracking
|
21
|
+
engine.exec_env.verbs.push verb
|
22
22
|
verb&.run
|
23
|
-
|
24
|
-
|
23
|
+
engine.exec_env.verbs.pop
|
24
|
+
engine.heap.error.clear_if_no_errors
|
25
25
|
end
|
26
26
|
|
27
27
|
#
|
28
28
|
# Send 'run' message to the object.
|
29
29
|
# Resolve the path_name and then send the run message.
|
30
30
|
#
|
31
|
-
def self.run( path_name )
|
32
|
-
|
33
|
-
pn = GlooLang::Core::Pn.new path_name
|
31
|
+
def self.run( engine, path_name )
|
32
|
+
engine.log.debug "running script at #{path_name}"
|
33
|
+
pn = GlooLang::Core::Pn.new( engine, path_name )
|
34
34
|
o = pn.resolve
|
35
35
|
|
36
36
|
if o
|
37
37
|
o.send_message 'run'
|
38
38
|
else
|
39
|
-
|
39
|
+
engine.log.error "Could not send message to object. Bad path: #{path_name}"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -13,7 +13,8 @@ module GlooLang
|
|
13
13
|
#
|
14
14
|
# Set up the script.
|
15
15
|
#
|
16
|
-
def initialize( obj )
|
16
|
+
def initialize( engine, obj )
|
17
|
+
@engine = engine
|
17
18
|
@obj = obj
|
18
19
|
end
|
19
20
|
|
@@ -23,17 +24,17 @@ module GlooLang
|
|
23
24
|
# of lines.
|
24
25
|
#
|
25
26
|
def run
|
26
|
-
|
27
|
+
@engine.exec_env.push_script self
|
27
28
|
|
28
29
|
if @obj.value.is_a? String
|
29
|
-
|
30
|
+
@engine.parser.run @obj.value
|
30
31
|
elsif @obj.value.is_a? Array
|
31
32
|
@obj.value.each do |line|
|
32
|
-
|
33
|
+
@engine.parser.run line
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
+
@engine.exec_env.pop_script
|
37
38
|
end
|
38
39
|
|
39
40
|
#
|
data/lib/gloo_lang/exec/stack.rb
CHANGED
@@ -13,19 +13,20 @@ module GlooLang
|
|
13
13
|
#
|
14
14
|
# Set up the stack.
|
15
15
|
#
|
16
|
-
def initialize( name )
|
16
|
+
def initialize( engine, name )
|
17
|
+
@engine = engine
|
17
18
|
@name = name
|
18
19
|
clear_stack
|
19
|
-
|
20
|
+
@engine.log.debug "#{name} stack intialized..."
|
20
21
|
end
|
21
22
|
|
22
23
|
#
|
23
24
|
# Push an item onto the stack.
|
24
25
|
#
|
25
26
|
def push( obj )
|
26
|
-
|
27
|
+
@engine.log.debug "#{@name}:push #{obj.display_value}"
|
27
28
|
@stack.push obj
|
28
|
-
self.update_out_file if
|
29
|
+
self.update_out_file if @engine.settings.debug
|
29
30
|
end
|
30
31
|
|
31
32
|
#
|
@@ -33,8 +34,8 @@ module GlooLang
|
|
33
34
|
#
|
34
35
|
def pop
|
35
36
|
o = @stack.pop
|
36
|
-
|
37
|
-
self.update_out_file if
|
37
|
+
@engine.log.debug "#{@name}:pop #{o.display_value}"
|
38
|
+
self.update_out_file if @engine.settings.debug
|
38
39
|
end
|
39
40
|
|
40
41
|
#
|
@@ -55,7 +56,7 @@ module GlooLang
|
|
55
56
|
# Get the file we'll write debug information for the stack.
|
56
57
|
#
|
57
58
|
def out_file
|
58
|
-
return File.join(
|
59
|
+
return File.join( @engine.settings.debug_path, @name )
|
59
60
|
end
|
60
61
|
|
61
62
|
#
|
@@ -15,7 +15,8 @@ module GlooLang
|
|
15
15
|
#
|
16
16
|
# Create the expression from a list of tokens.
|
17
17
|
#
|
18
|
-
def initialize( tokens )
|
18
|
+
def initialize( engine, tokens )
|
19
|
+
@engine = engine
|
19
20
|
@tokens = tokens
|
20
21
|
@symbols = []
|
21
22
|
@left = nil
|
@@ -110,7 +111,7 @@ module GlooLang
|
|
110
111
|
return LDecimal.new( token ) if LDecimal.decimal?( token )
|
111
112
|
|
112
113
|
# last chance: an Object reference
|
113
|
-
return GlooLang::Core::Pn.new( token )
|
114
|
+
return GlooLang::Core::Pn.new( @engine, token )
|
114
115
|
end
|
115
116
|
|
116
117
|
end
|
@@ -48,9 +48,9 @@ module GlooLang
|
|
48
48
|
# Check to see if the referenced object exists.
|
49
49
|
#
|
50
50
|
def msg_resolve
|
51
|
-
pn = GlooLang::Core::Pn.new( self.value )
|
51
|
+
pn = GlooLang::Core::Pn.new( @engine, self.value )
|
52
52
|
s = pn.exists?
|
53
|
-
|
53
|
+
@engine.heap.it.set_to s
|
54
54
|
return s
|
55
55
|
end
|
56
56
|
|
@@ -64,12 +64,12 @@ module GlooLang
|
|
64
64
|
# If it ends with the * then we won't resolve the alias since
|
65
65
|
# we are trying to refer to the alias itself.
|
66
66
|
#
|
67
|
-
def self.resolve_alias( obj, ref_name = nil )
|
67
|
+
def self.resolve_alias( engine, obj, ref_name = nil )
|
68
68
|
return nil unless obj
|
69
69
|
return obj unless obj.type_display == GlooLang::Objs::Alias.typename
|
70
70
|
return obj if ref_name&.end_with?( ALIAS_REFERENCE )
|
71
71
|
|
72
|
-
ln = GlooLang::Core::Pn.new( obj.value )
|
72
|
+
ln = GlooLang::Core::Pn.new( engine, obj.value )
|
73
73
|
return ln.resolve
|
74
74
|
end
|
75
75
|
|
@@ -93,7 +93,7 @@ module GlooLang
|
|
93
93
|
def msg_not
|
94
94
|
v = !value
|
95
95
|
set_value v
|
96
|
-
|
96
|
+
@engine.heap.it.set_to v
|
97
97
|
return v
|
98
98
|
end
|
99
99
|
|
@@ -102,7 +102,7 @@ module GlooLang
|
|
102
102
|
#
|
103
103
|
def msg_true
|
104
104
|
set_value true
|
105
|
-
|
105
|
+
@engine.heap.it.set_to true
|
106
106
|
return true
|
107
107
|
end
|
108
108
|
|
@@ -111,7 +111,7 @@ module GlooLang
|
|
111
111
|
#
|
112
112
|
def msg_false
|
113
113
|
set_value false
|
114
|
-
|
114
|
+
@engine.heap.it.set_to false
|
115
115
|
return false
|
116
116
|
end
|
117
117
|
|
@@ -41,7 +41,7 @@ module GlooLang
|
|
41
41
|
#
|
42
42
|
def msg_count
|
43
43
|
i = child_count
|
44
|
-
|
44
|
+
@engine.heap.it.set_to i
|
45
45
|
return i
|
46
46
|
end
|
47
47
|
|
@@ -57,7 +57,7 @@ module GlooLang
|
|
57
57
|
#
|
58
58
|
def msg_show_key_value_table
|
59
59
|
data = self.children.map { |o| [ o.name, o.value ] }
|
60
|
-
|
60
|
+
@engine.platform.show_table nil, data, title
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
@@ -35,7 +35,7 @@ module GlooLang
|
|
35
35
|
end
|
36
36
|
|
37
37
|
unless new_value.is_a? Numeric
|
38
|
-
self.value =
|
38
|
+
self.value = @engine.converter.convert( new_value, 'Decimal', 0.0 )
|
39
39
|
return
|
40
40
|
end
|
41
41
|
|
@@ -61,13 +61,13 @@ module GlooLang
|
|
61
61
|
def msg_round
|
62
62
|
data = 0
|
63
63
|
if @params&.token_count&.positive?
|
64
|
-
expr = GlooLang::Expr::Expression.new( @params.tokens )
|
64
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
65
65
|
data = expr.evaluate.to_i
|
66
66
|
end
|
67
67
|
|
68
68
|
i = self.value.round( data )
|
69
69
|
set_value i
|
70
|
-
|
70
|
+
@engine.heap.it.set_to i
|
71
71
|
return i
|
72
72
|
end
|
73
73
|
|
@@ -30,7 +30,7 @@ module GlooLang
|
|
30
30
|
#
|
31
31
|
def set_value( new_value )
|
32
32
|
unless new_value.is_a? Numeric
|
33
|
-
self.value =
|
33
|
+
self.value = @engine.converter.convert( new_value, 'Integer', 0 )
|
34
34
|
return
|
35
35
|
end
|
36
36
|
|
@@ -54,7 +54,7 @@ module GlooLang
|
|
54
54
|
def msg_inc
|
55
55
|
i = value + 1
|
56
56
|
set_value i
|
57
|
-
|
57
|
+
@engine.heap.it.set_to i
|
58
58
|
return i
|
59
59
|
end
|
60
60
|
|
@@ -64,7 +64,7 @@ module GlooLang
|
|
64
64
|
def msg_dec
|
65
65
|
i = value - 1
|
66
66
|
set_value i
|
67
|
-
|
67
|
+
@engine.heap.it.set_to i
|
68
68
|
return i
|
69
69
|
end
|
70
70
|
|
@@ -48,7 +48,7 @@ module GlooLang
|
|
48
48
|
#
|
49
49
|
def msg_size
|
50
50
|
s = value.size
|
51
|
-
|
51
|
+
@engine.heap.it.set_to s
|
52
52
|
return s
|
53
53
|
end
|
54
54
|
|
@@ -58,7 +58,7 @@ module GlooLang
|
|
58
58
|
def msg_up
|
59
59
|
s = value.upcase
|
60
60
|
set_value s
|
61
|
-
|
61
|
+
@engine.heap.it.set_to s
|
62
62
|
return s
|
63
63
|
end
|
64
64
|
|
@@ -68,7 +68,7 @@ module GlooLang
|
|
68
68
|
def msg_down
|
69
69
|
s = value.downcase
|
70
70
|
set_value s
|
71
|
-
|
71
|
+
@engine.heap.it.set_to s
|
72
72
|
return s
|
73
73
|
end
|
74
74
|
|
@@ -64,14 +64,14 @@ module GlooLang
|
|
64
64
|
def msg_page
|
65
65
|
return unless value
|
66
66
|
|
67
|
-
|
67
|
+
@engine.platform.show( value, false, true )
|
68
68
|
end
|
69
69
|
|
70
70
|
#
|
71
71
|
# Edit the text in the default editor.
|
72
72
|
#
|
73
73
|
def msg_edit
|
74
|
-
self.value =
|
74
|
+
self.value = @engine.platform.edit( self.value )
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|
@@ -53,7 +53,7 @@ module GlooLang
|
|
53
53
|
o = find_child DO
|
54
54
|
return unless o
|
55
55
|
|
56
|
-
GlooLang::Exec::Dispatch.message 'run', o
|
56
|
+
GlooLang::Exec::Dispatch.message( @engine, 'run', o )
|
57
57
|
end
|
58
58
|
|
59
59
|
# ---------------------------------------------------------------------
|
@@ -75,7 +75,7 @@ module GlooLang
|
|
75
75
|
# for default configurations.
|
76
76
|
#
|
77
77
|
def add_default_children
|
78
|
-
fac =
|
78
|
+
fac = @engine.factory
|
79
79
|
fac.create_string WORD, '', self
|
80
80
|
fac.create_string IN, '', self
|
81
81
|
fac.create_script DO, '', self
|
@@ -127,7 +127,7 @@ module GlooLang
|
|
127
127
|
o = find_child IN
|
128
128
|
return unless o
|
129
129
|
|
130
|
-
o = GlooLang::Objs::Alias.resolve_alias( o )
|
130
|
+
o = GlooLang::Objs::Alias.resolve_alias( @engine, o )
|
131
131
|
o.children.each do |child|
|
132
132
|
set_child child
|
133
133
|
run_do
|
@@ -44,7 +44,7 @@ module GlooLang
|
|
44
44
|
o = find_child DO
|
45
45
|
return unless o
|
46
46
|
|
47
|
-
GlooLang::Exec::Dispatch.message 'run', o
|
47
|
+
GlooLang::Exec::Dispatch.message( @engine, 'run', o )
|
48
48
|
end
|
49
49
|
|
50
50
|
#
|
@@ -76,7 +76,7 @@ module GlooLang
|
|
76
76
|
# for default configurations.
|
77
77
|
#
|
78
78
|
def add_default_children
|
79
|
-
fac =
|
79
|
+
fac = @engine.factory
|
80
80
|
fac.create_int TIMES, 0, self
|
81
81
|
fac.create_int INDEX, 0, self
|
82
82
|
fac.create_script DO, '', self
|
@@ -62,7 +62,7 @@ module GlooLang
|
|
62
62
|
# Show the markdown data in the terminal.
|
63
63
|
#
|
64
64
|
def msg_show
|
65
|
-
|
65
|
+
@engine.platform.show( self.value, true, false )
|
66
66
|
end
|
67
67
|
|
68
68
|
#
|
@@ -71,7 +71,7 @@ module GlooLang
|
|
71
71
|
def msg_page
|
72
72
|
return unless self.value
|
73
73
|
|
74
|
-
|
74
|
+
@engine.platform.show( md, true, true )
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|
@@ -52,7 +52,7 @@ module GlooLang
|
|
52
52
|
# for default configurations.
|
53
53
|
#
|
54
54
|
def add_default_children
|
55
|
-
fac =
|
55
|
+
fac = @engine.factory
|
56
56
|
fac.create_alias DB, nil, self
|
57
57
|
fac.create_string SQL, nil, self
|
58
58
|
fac.create_can RESULT, self
|
@@ -75,7 +75,7 @@ module GlooLang
|
|
75
75
|
def msg_run
|
76
76
|
db = db_obj
|
77
77
|
unless db
|
78
|
-
|
78
|
+
@engine.err DB_MISSING_ERR
|
79
79
|
return
|
80
80
|
end
|
81
81
|
|
@@ -94,7 +94,7 @@ module GlooLang
|
|
94
94
|
#
|
95
95
|
def db_obj
|
96
96
|
o = find_child DB
|
97
|
-
return GlooLang::Objs::Alias.resolve_alias( o )
|
97
|
+
return GlooLang::Objs::Alias.resolve_alias( @engine, o )
|
98
98
|
end
|
99
99
|
|
100
100
|
#
|
@@ -161,7 +161,7 @@ module GlooLang
|
|
161
161
|
#
|
162
162
|
def update_result_contaier( data )
|
163
163
|
r = find_child RESULT
|
164
|
-
r = GlooLang::Objs::Alias.resolve_alias( r )
|
164
|
+
r = GlooLang::Objs::Alias.resolve_alias( @engine, r )
|
165
165
|
data.each_with_index do |row, i|
|
166
166
|
can = r.find_add_child( i.to_s, 'can' )
|
167
167
|
row.each do |k, v|
|
@@ -57,7 +57,7 @@ module GlooLang
|
|
57
57
|
o = find_child DATA
|
58
58
|
return [] unless o
|
59
59
|
|
60
|
-
o = GlooLang::Objs::Alias.resolve_alias( o )
|
60
|
+
o = GlooLang::Objs::Alias.resolve_alias( @engine, o )
|
61
61
|
cols = self.columns
|
62
62
|
return o.children.map do |e|
|
63
63
|
cols.map { |h| e.find_child( h ).value }
|
@@ -83,7 +83,7 @@ module GlooLang
|
|
83
83
|
# for default configurations.
|
84
84
|
#
|
85
85
|
def add_default_children
|
86
|
-
fac =
|
86
|
+
fac = @engine.factory
|
87
87
|
fac.create_can HEADERS, self
|
88
88
|
fac.create_can DATA, self
|
89
89
|
end
|
@@ -104,7 +104,7 @@ module GlooLang
|
|
104
104
|
#
|
105
105
|
def msg_show
|
106
106
|
title = self.value
|
107
|
-
|
107
|
+
@engine.platform.show_table headers, data, title
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
@@ -30,7 +30,7 @@ module GlooLang
|
|
30
30
|
#
|
31
31
|
def set_value( new_value )
|
32
32
|
unless new_value.is_a? DateTime
|
33
|
-
self.value =
|
33
|
+
self.value = @engine.converter.convert( new_value, 'DateTime', nil )
|
34
34
|
return
|
35
35
|
end
|
36
36
|
|
@@ -54,7 +54,7 @@ module GlooLang
|
|
54
54
|
def msg_now
|
55
55
|
t = DateTime.now.strftime( '%Y.%m.%d %I:%M:%S %P' )
|
56
56
|
self.value = t
|
57
|
-
|
57
|
+
@engine.heap.it.set_to t
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
@@ -57,7 +57,7 @@ module GlooLang
|
|
57
57
|
|
58
58
|
body = find_child PARAMS
|
59
59
|
body.children.each do |child|
|
60
|
-
child = GlooLang::Objs::Alias.resolve_alias( child )
|
60
|
+
child = GlooLang::Objs::Alias.resolve_alias( @engine, child )
|
61
61
|
h[ child.name ] = child.value
|
62
62
|
end
|
63
63
|
|
@@ -83,7 +83,7 @@ module GlooLang
|
|
83
83
|
# for default configurations.
|
84
84
|
#
|
85
85
|
def add_default_children
|
86
|
-
fac =
|
86
|
+
fac = @engine.factory
|
87
87
|
fac.create_text TEMPLATE, '', self
|
88
88
|
fac.create_can PARAMS, self
|
89
89
|
fac.create_text RESULT, '', self
|
@@ -68,7 +68,7 @@ module GlooLang
|
|
68
68
|
# for default configurations.
|
69
69
|
#
|
70
70
|
def add_default_children
|
71
|
-
fac =
|
71
|
+
fac = @engine.factory
|
72
72
|
fac.create_string CMD, DEFAULT_CMD, self
|
73
73
|
fac.create_string RESULT, nil, self
|
74
74
|
end
|
@@ -96,9 +96,9 @@ module GlooLang
|
|
96
96
|
result = eval cmd
|
97
97
|
# rubocop:enable Security/Eval
|
98
98
|
set_result result
|
99
|
-
|
99
|
+
@engine.heap.it.set_to result
|
100
100
|
rescue => e
|
101
|
-
|
101
|
+
@engine.err e.message
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|