gloo 3.8.0 → 3.9.0
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/VERSION_NOTES +9 -0
- data/lib/gloo/app/log.rb +1 -1
- data/lib/gloo/core/op.rb +27 -7
- data/lib/gloo/expr/op_div.rb +2 -0
- data/lib/gloo/expr/op_eq.rb +29 -0
- data/lib/gloo/expr/op_gt.rb +26 -0
- data/lib/gloo/expr/op_gteq.rb +26 -0
- data/lib/gloo/expr/op_ineq.rb +28 -0
- data/lib/gloo/expr/op_lt.rb +26 -0
- data/lib/gloo/expr/op_lteq.rb +26 -0
- data/lib/gloo/expr/op_minus.rb +2 -0
- data/lib/gloo/expr/op_mult.rb +2 -0
- data/lib/gloo/expr/op_plus.rb +2 -0
- data/lib/gloo/objs/basic/string.rb +87 -1
- data/lib/gloo/objs/ctrl/each_child.rb +87 -0
- data/lib/gloo/objs/web_svr/page.rb +2 -0
- data/lib/gloo/verbs/load.rb +1 -1
- data/lib/gloo/verbs/save.rb +1 -1
- data/lib/gloo/verbs/show.rb +1 -1
- data/lib/gloo/web_svr/table_renderer.rb +3 -3
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afc950a2a2470041f3a3d990480cf26bee1005e6f4e00bcc95feb4e38d8de394
|
4
|
+
data.tar.gz: fe2cf5549734e2779ed1ed1f90bc5974fcae7c0b8245b22626a9828d2f54c54e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7eed261a94581ca0a1e7f5c9a61657bd8e39f1455d55f4754bc4530641fe33ef359d7055f191dd204c505b31e501291803f5ef5822672640a280845c5c27b0d1
|
7
|
+
data.tar.gz: 643bd6cc65823bf8d1a8d1666e0b5b51abf5c44d0a8f2b25b51c901a1f18c3efda08264c5e686fe34efb0063a7e9e56b7040c50befa353e17369f0c04f32b186
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.9.0
|
data/lib/VERSION_NOTES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
3.9.0 - 2025.02.21
|
2
|
+
- Fixes alias in page parameters
|
3
|
+
- Adds comparison operators
|
4
|
+
- Renames some verb shortcuts for compatibility
|
5
|
+
- Adds Group-By option in for each child loop
|
6
|
+
- Adds starts_with?, ends_with?, contains?, and format_for_html messages to string
|
7
|
+
|
8
|
+
|
9
|
+
|
1
10
|
3.8.0 - 2025.01.23
|
2
11
|
- Fixes issue with sessions
|
3
12
|
- Adds authenticity token tag and supporting session id and validation
|
data/lib/gloo/app/log.rb
CHANGED
data/lib/gloo/core/op.rb
CHANGED
@@ -13,19 +13,39 @@ module Gloo
|
|
13
13
|
# Is the token an operator?
|
14
14
|
#
|
15
15
|
def self.op?( token )
|
16
|
-
return [
|
16
|
+
return [
|
17
|
+
Gloo::Expr::OpPlus::SYMBOL,
|
18
|
+
Gloo::Expr::OpMinus::SYMBOL,
|
19
|
+
Gloo::Expr::OpMult::SYMBOL,
|
20
|
+
Gloo::Expr::OpDiv::SYMBOL,
|
21
|
+
Gloo::Expr::OpEq::SYMBOL,
|
22
|
+
Gloo::Expr::OpEq::ALT_SYMBOL,
|
23
|
+
Gloo::Expr::OpIneq::SYMBOL,
|
24
|
+
Gloo::Expr::OpGt::SYMBOL,
|
25
|
+
Gloo::Expr::OpLt::SYMBOL,
|
26
|
+
Gloo::Expr::OpGteq::SYMBOL,
|
27
|
+
Gloo::Expr::OpLteq::SYMBOL
|
28
|
+
].include?( token.strip )
|
17
29
|
end
|
18
30
|
|
19
31
|
#
|
20
32
|
# Create the operator for the given token.
|
21
33
|
#
|
22
34
|
def self.create_op( token )
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
35
|
+
case token
|
36
|
+
when Gloo::Expr::OpPlus::SYMBOL then Gloo::Expr::OpPlus.new
|
37
|
+
when Gloo::Expr::OpMinus::SYMBOL then Gloo::Expr::OpMinus.new
|
38
|
+
when Gloo::Expr::OpMult::SYMBOL then Gloo::Expr::OpMult.new
|
39
|
+
when Gloo::Expr::OpDiv::SYMBOL then Gloo::Expr::OpDiv.new
|
40
|
+
when Gloo::Expr::OpEq::SYMBOL then return Gloo::Expr::OpEq.new
|
41
|
+
when Gloo::Expr::OpEq::ALT_SYMBOL then return Gloo::Expr::OpEq.new
|
42
|
+
when Gloo::Expr::OpIneq::SYMBOL then return Gloo::Expr::OpIneq.new
|
43
|
+
when Gloo::Expr::OpGt::SYMBOL then return Gloo::Expr::OpGt.new
|
44
|
+
when Gloo::Expr::OpLt::SYMBOL then return Gloo::Expr::OpLt.new
|
45
|
+
when Gloo::Expr::OpGteq::SYMBOL then return Gloo::Expr::OpGteq.new
|
46
|
+
when Gloo::Expr::OpLteq::SYMBOL then return Gloo::Expr::OpLteq.new
|
47
|
+
else return default_op
|
48
|
+
end
|
29
49
|
end
|
30
50
|
|
31
51
|
#
|
data/lib/gloo/expr/op_div.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2025 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Equality operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Expr
|
9
|
+
class OpEq < Gloo::Core::Op
|
10
|
+
|
11
|
+
SYMBOL = '='.freeze
|
12
|
+
ALT_SYMBOL = '=='.freeze
|
13
|
+
|
14
|
+
#
|
15
|
+
# Perform the operation and return the result.
|
16
|
+
#
|
17
|
+
def perform( left, right )
|
18
|
+
return left == right.to_s if left.is_a? String
|
19
|
+
|
20
|
+
return left == right.to_i if left.is_a? Integer
|
21
|
+
|
22
|
+
return left == right.to_f if left.is_a? Numeric
|
23
|
+
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2025 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Greater than operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Expr
|
9
|
+
class OpGt < Gloo::Core::Op
|
10
|
+
|
11
|
+
SYMBOL = '>'.freeze
|
12
|
+
|
13
|
+
#
|
14
|
+
# Perform the operation and return the result.
|
15
|
+
#
|
16
|
+
def perform( left, right )
|
17
|
+
return left > right.to_i if left.is_a? Integer
|
18
|
+
|
19
|
+
return left > right.to_f if left.is_a? Numeric
|
20
|
+
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2025 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Greater than or equal operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Expr
|
9
|
+
class OpGteq < Gloo::Core::Op
|
10
|
+
|
11
|
+
SYMBOL = '>='.freeze
|
12
|
+
|
13
|
+
#
|
14
|
+
# Perform the operation and return the result.
|
15
|
+
#
|
16
|
+
def perform( left, right )
|
17
|
+
return left >= right.to_i if left.is_a? Integer
|
18
|
+
|
19
|
+
return left >= right.to_f if left.is_a? Numeric
|
20
|
+
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2025 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Inequality operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Expr
|
9
|
+
class OpIneq < Gloo::Core::Op
|
10
|
+
|
11
|
+
SYMBOL = '!='.freeze
|
12
|
+
|
13
|
+
#
|
14
|
+
# Perform the operation and return the result.
|
15
|
+
#
|
16
|
+
def perform( left, right )
|
17
|
+
return left != right.to_s if left.is_a? String
|
18
|
+
|
19
|
+
return left != right.to_i if left.is_a? Integer
|
20
|
+
|
21
|
+
return left != right.to_f if left.is_a? Numeric
|
22
|
+
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2025 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Less than operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Expr
|
9
|
+
class OpLt < Gloo::Core::Op
|
10
|
+
|
11
|
+
SYMBOL = '<'.freeze
|
12
|
+
|
13
|
+
#
|
14
|
+
# Perform the operation and return the result.
|
15
|
+
#
|
16
|
+
def perform( left, right )
|
17
|
+
return left < right.to_i if left.is_a? Integer
|
18
|
+
|
19
|
+
return left < right.to_f if left.is_a? Numeric
|
20
|
+
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2025 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Less than or equal operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Expr
|
9
|
+
class OpLteq < Gloo::Core::Op
|
10
|
+
|
11
|
+
SYMBOL = '<='.freeze
|
12
|
+
|
13
|
+
#
|
14
|
+
# Perform the operation and return the result.
|
15
|
+
#
|
16
|
+
def perform( left, right )
|
17
|
+
return left <= right.to_i if left.is_a? Integer
|
18
|
+
|
19
|
+
return left <= right.to_f if left.is_a? Numeric
|
20
|
+
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/gloo/expr/op_minus.rb
CHANGED
data/lib/gloo/expr/op_mult.rb
CHANGED
data/lib/gloo/expr/op_plus.rb
CHANGED
@@ -12,6 +12,7 @@ module Gloo
|
|
12
12
|
|
13
13
|
KEYWORD = 'string'.freeze
|
14
14
|
KEYWORD_SHORT = 'str'.freeze
|
15
|
+
MISSING_PARAM_MSG = 'Missing parameter!'.freeze
|
15
16
|
|
16
17
|
#
|
17
18
|
# The name of the object type.
|
@@ -42,10 +43,95 @@ module Gloo
|
|
42
43
|
# Get a list of message names that this object receives.
|
43
44
|
#
|
44
45
|
def self.messages
|
45
|
-
return super + %w[up down size
|
46
|
+
return super + %w[up down size starts_with? ends_with? contains?
|
47
|
+
format_for_html encode64 decode64 escape unescape
|
46
48
|
gen_alphanumeric gen_uuid gen_hex gen_base64]
|
47
49
|
end
|
48
50
|
|
51
|
+
#
|
52
|
+
# Convert whitespace to HTML friendly spaces.
|
53
|
+
#
|
54
|
+
def msg_format_for_html
|
55
|
+
text = self.value
|
56
|
+
out = ""
|
57
|
+
return out unless text
|
58
|
+
|
59
|
+
# indentation
|
60
|
+
text.each_line do |line|
|
61
|
+
i = 0
|
62
|
+
while line[i] == ' '
|
63
|
+
i += 1
|
64
|
+
out << " "
|
65
|
+
end
|
66
|
+
|
67
|
+
i = 0
|
68
|
+
while line[i] == "\t"
|
69
|
+
i += 1
|
70
|
+
out << " "
|
71
|
+
end
|
72
|
+
out << line
|
73
|
+
end
|
74
|
+
|
75
|
+
self.value = out.gsub( "\n", "<br/>" )
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Does the string start with the given string?
|
80
|
+
#
|
81
|
+
def msg_starts_with?
|
82
|
+
if @params&.token_count&.positive?
|
83
|
+
expr = Gloo::Expr::Expression.new( @engine, @params.tokens )
|
84
|
+
data = expr.evaluate
|
85
|
+
|
86
|
+
result = self.value.start_with?( data )
|
87
|
+
@engine.heap.it.set_to result
|
88
|
+
return result
|
89
|
+
else
|
90
|
+
# Error
|
91
|
+
@engine.log.error MISSING_PARAM_MSG
|
92
|
+
@engine.heap.it.set_to false
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# Does the string end with the given string?
|
99
|
+
#
|
100
|
+
def msg_ends_with?
|
101
|
+
if @params&.token_count&.positive?
|
102
|
+
expr = Gloo::Expr::Expression.new( @engine, @params.tokens )
|
103
|
+
data = expr.evaluate
|
104
|
+
|
105
|
+
result = value.end_with?( data )
|
106
|
+
@engine.heap.it.set_to result
|
107
|
+
return result
|
108
|
+
else
|
109
|
+
# Error
|
110
|
+
@engine.log.error MISSING_PARAM_MSG
|
111
|
+
@engine.heap.it.set_to false
|
112
|
+
return false
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Does the string contain the given string?
|
118
|
+
#
|
119
|
+
def msg_contains?
|
120
|
+
if @params&.token_count&.positive?
|
121
|
+
expr = Gloo::Expr::Expression.new( @engine, @params.tokens )
|
122
|
+
data = expr.evaluate
|
123
|
+
|
124
|
+
result = value.include?( data )
|
125
|
+
@engine.heap.it.set_to result
|
126
|
+
return result
|
127
|
+
else
|
128
|
+
# Error
|
129
|
+
@engine.log.error MISSING_PARAM_MSG
|
130
|
+
@engine.heap.it.set_to false
|
131
|
+
return false
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
49
135
|
#
|
50
136
|
# Get the size of the string.
|
51
137
|
#
|
@@ -10,6 +10,11 @@ module Gloo
|
|
10
10
|
|
11
11
|
CHILD = 'child'.freeze
|
12
12
|
IN = 'IN'.freeze
|
13
|
+
|
14
|
+
GROUP_BY = 'group_by'.freeze
|
15
|
+
ON_GROUP_START = 'on_group_start'.freeze
|
16
|
+
ON_GROUP_END = 'on_group_end'.freeze
|
17
|
+
|
13
18
|
|
14
19
|
# ---------------------------------------------------------------------
|
15
20
|
# Create Iterator
|
@@ -34,6 +39,61 @@ module Gloo
|
|
34
39
|
return false
|
35
40
|
end
|
36
41
|
|
42
|
+
|
43
|
+
# ---------------------------------------------------------------------
|
44
|
+
# Group By
|
45
|
+
# ---------------------------------------------------------------------
|
46
|
+
|
47
|
+
#
|
48
|
+
# If the iterator has a group by,
|
49
|
+
# then we need to group by that value.
|
50
|
+
# Otherwise, we just loop for each child.
|
51
|
+
#
|
52
|
+
def has_group_by?
|
53
|
+
child = @iterator_obj.find_child GROUP_BY
|
54
|
+
return false unless child
|
55
|
+
|
56
|
+
return true
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Get the child that is the group by.
|
61
|
+
# Return nil if there is no group by.
|
62
|
+
#
|
63
|
+
def group_by_value obj_can
|
64
|
+
return nil unless obj_can
|
65
|
+
|
66
|
+
child = @iterator_obj.find_child GROUP_BY
|
67
|
+
return nil unless child
|
68
|
+
|
69
|
+
group_by_child_name = child.value
|
70
|
+
|
71
|
+
obj = obj_can.find_child( group_by_child_name )
|
72
|
+
return nil unless obj
|
73
|
+
|
74
|
+
return obj.value
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# Run the on group start script.
|
79
|
+
#
|
80
|
+
def run_on_group_start
|
81
|
+
o = @iterator_obj.find_child ON_GROUP_START
|
82
|
+
return unless o
|
83
|
+
|
84
|
+
Gloo::Exec::Dispatch.message( @engine, 'run', o )
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# Run the on group end script.
|
89
|
+
#
|
90
|
+
def run_on_group_end
|
91
|
+
o = @iterator_obj.find_child ON_GROUP_END
|
92
|
+
return unless o
|
93
|
+
|
94
|
+
Gloo::Exec::Dispatch.message( @engine, 'run', o )
|
95
|
+
end
|
96
|
+
|
37
97
|
|
38
98
|
# ---------------------------------------------------------------------
|
39
99
|
# Iterate
|
@@ -46,11 +106,38 @@ module Gloo
|
|
46
106
|
o = @iterator_obj.find_child IN
|
47
107
|
return unless o
|
48
108
|
|
109
|
+
# Set up for optional groups.
|
110
|
+
group_mode = false
|
111
|
+
if has_group_by?
|
112
|
+
group_mode = true
|
113
|
+
last_group = nil
|
114
|
+
first_time = true
|
115
|
+
end
|
116
|
+
|
49
117
|
o = Gloo::Objs::Alias.resolve_alias( @engine, o )
|
50
118
|
o.children.each do |child|
|
119
|
+
if group_mode
|
120
|
+
group_value = group_by_value( child )
|
121
|
+
# puts "last group = #{last_group}, group_value = #{group_value}"
|
122
|
+
if last_group != group_value
|
123
|
+
last_group = group_value
|
124
|
+
# puts "New group: #{group_value}"
|
125
|
+
if first_time
|
126
|
+
first_time = false
|
127
|
+
else
|
128
|
+
run_on_group_end
|
129
|
+
end
|
130
|
+
run_on_group_start
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
51
134
|
set_child child
|
52
135
|
@iterator_obj.run_do
|
53
136
|
end
|
137
|
+
|
138
|
+
if group_mode && !first_time
|
139
|
+
run_on_group_end
|
140
|
+
end
|
54
141
|
end
|
55
142
|
|
56
143
|
#
|
data/lib/gloo/verbs/load.rb
CHANGED
data/lib/gloo/verbs/save.rb
CHANGED
data/lib/gloo/verbs/show.rb
CHANGED
@@ -73,8 +73,8 @@ module Gloo
|
|
73
73
|
end
|
74
74
|
|
75
75
|
str += "<tr class='#{styles[ ROW ]}'>"
|
76
|
-
str += "<th
|
77
|
-
str += "<td
|
76
|
+
str += "<th class='#{styles[ HEAD_CELL ]}'>#{head[ :title ]}</th>"
|
77
|
+
str += "<td class='#{styles[ CELL ]}'>#{cell_value}</td>"
|
78
78
|
str += "</tr>"
|
79
79
|
end
|
80
80
|
|
@@ -113,7 +113,7 @@ module Gloo
|
|
113
113
|
else
|
114
114
|
cell_value = cell
|
115
115
|
end
|
116
|
-
str += "<td
|
116
|
+
str += "<td class='#{styles[ CELL ]}'>#{cell_value}</td>"
|
117
117
|
end
|
118
118
|
str += "</tr>"
|
119
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gloo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Crane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -419,6 +419,12 @@ files:
|
|
419
419
|
- lib/gloo/expr/l_integer.rb
|
420
420
|
- lib/gloo/expr/l_string.rb
|
421
421
|
- lib/gloo/expr/op_div.rb
|
422
|
+
- lib/gloo/expr/op_eq.rb
|
423
|
+
- lib/gloo/expr/op_gt.rb
|
424
|
+
- lib/gloo/expr/op_gteq.rb
|
425
|
+
- lib/gloo/expr/op_ineq.rb
|
426
|
+
- lib/gloo/expr/op_lt.rb
|
427
|
+
- lib/gloo/expr/op_lteq.rb
|
422
428
|
- lib/gloo/expr/op_minus.rb
|
423
429
|
- lib/gloo/expr/op_mult.rb
|
424
430
|
- lib/gloo/expr/op_plus.rb
|