gloo 5.2.0 → 5.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d8c482026223309622ed85dc80193049e31fae2e870a684ed06b3f2efd569db
4
- data.tar.gz: 03c8934d55dd19011f4f5b2d8c83f94421cd0e6dcd38aae2ef1f5b805afac074
3
+ metadata.gz: fd23c0a7c35ccfa82d8d1a1bfefb58ea777b1ba17038e77dd4925c07bb3a8914
4
+ data.tar.gz: 23c13541622b6c280af260c0ee66f1246748b9584b34886f27c4966fca8668e2
5
5
  SHA512:
6
- metadata.gz: 6b871e91af4d2c1fdba956fc3a3cd2f8a0c260785b00aa3777aed042b6d1b6a7bfaab874e86dfd8201f7d72b2ea8ed43700a22630363a595c02382b4e28510b7
7
- data.tar.gz: 7a421e84aec1e38174484a82125e257b237022be96f361d9abea009e0ed3e9d3b4b1ce60600055647a9851754391f5d4c91b18c1f25b987efaafd4db93a0e297
6
+ metadata.gz: dd6ae78a5ea5fd546707782c98fc19e3f40c7e1593e495b372624373a6d9aede414cd0a33e3e34ec90a3fa3ee982a80877eb88236eac2f0f2c81a1e418678bcf
7
+ data.tar.gz: 29692c9ed3e86ca90d3fbcc7b5cc4edc904f37b26125e92c0cff854ebe778dd6b22d814f41e79a41dc2e676db27cdc30c67da59f4bd152745f99eedda73b4b1f
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 5.2.0
1
+ 5.3.0
data/lib/VERSION_NOTES CHANGED
@@ -1,3 +1,7 @@
1
+ 5.3.0 - 2026.03.10
2
+ - Adds segement messages to date and time objects.
3
+
4
+
1
5
  5.2.0 - 2026.03.06
2
6
  - Adds check to prevent loading lib or ext twice.
3
7
  - Updates the load and reload to support loading and unloading tests.
@@ -58,7 +58,7 @@ module Gloo
58
58
  # Get a list of message names that this object receives.
59
59
  #
60
60
  def self.messages
61
- return super + %w[now add sub]
61
+ return super + %w[now add sub mm dd yy yyyy]
62
62
  end
63
63
 
64
64
  #
@@ -102,6 +102,37 @@ module Gloo
102
102
  @engine.heap.it.set_to self.value
103
103
  end
104
104
 
105
+ #
106
+ # Get the month.
107
+ #
108
+ def msg_mm
109
+ dt = Chronic.parse( self.value )
110
+ @engine.heap.it.set_to "#{dt.month}".rjust(2, '0')
111
+ end
112
+
113
+ #
114
+ # Get the day.
115
+ #
116
+ def msg_dd
117
+ dt = Chronic.parse( self.value )
118
+ @engine.heap.it.set_to "#{dt.day}".rjust(2, '0')
119
+ end
120
+
121
+ #
122
+ # Get the year.
123
+ #
124
+ def msg_yyyy
125
+ dt = Chronic.parse( self.value )
126
+ @engine.heap.it.set_to dt.year.to_s
127
+ end
128
+
129
+ #
130
+ # Get the year (2 digit).
131
+ #
132
+ def msg_yy
133
+ dt = Chronic.parse( self.value )
134
+ @engine.heap.it.set_to dt.year.to_s[-2..-1]
135
+ end
105
136
  end
106
137
  end
107
138
  end
@@ -58,7 +58,7 @@ module Gloo
58
58
  # Get a list of message names that this object receives.
59
59
  #
60
60
  def self.messages
61
- return super + %w[now add sub]
61
+ return super + %w[now add sub hh mm ss am]
62
62
  end
63
63
 
64
64
  #
@@ -101,6 +101,38 @@ module Gloo
101
101
  self.set_value( DtTools.sub( dt, modifier ) )
102
102
  @engine.heap.it.set_to self.value
103
103
  end
104
+
105
+ #
106
+ # Get the hour.
107
+ #
108
+ def msg_hh
109
+ dt = Chronic.parse( self.value )
110
+ @engine.heap.it.set_to "#{dt.hour}".rjust(2, '0')
111
+ end
112
+
113
+ #
114
+ # Get the minute.
115
+ #
116
+ def msg_mm
117
+ dt = Chronic.parse( self.value )
118
+ @engine.heap.it.set_to "#{dt.min}".rjust(2, '0')
119
+ end
120
+
121
+ #
122
+ # Get the second.
123
+ #
124
+ def msg_ss
125
+ dt = Chronic.parse( self.value )
126
+ @engine.heap.it.set_to "#{dt.sec}".rjust(2, '0')
127
+ end
128
+
129
+ #
130
+ # Get the AM/PM.
131
+ #
132
+ def msg_am
133
+ dt = Chronic.parse( self.value )
134
+ @engine.heap.it.set_to dt.strftime( '%p' )
135
+ end
104
136
  end
105
137
  end
106
138
  end
@@ -0,0 +1,76 @@
1
+ #
2
+ # Boolean tests
3
+ #
4
+
5
+ tests [can] :
6
+ dt [can] :
7
+ date [can] :
8
+
9
+ d [date] :
10
+ x [date] :
11
+ future [date] :
12
+
13
+ now [test] :
14
+ description [string] : Get the current date
15
+ on_test [script] :
16
+ check ^^.x for blank?
17
+ assert "expected new date to be blank"
18
+
19
+ tell ^^.x to now
20
+ check ^^.x for blank?
21
+ refute "expected date to not be blank"
22
+
23
+ tell ^^.d to now
24
+ eval ^^.d = ^^.x
25
+ assert "expected dates to be equal"
26
+
27
+ add [test] :
28
+ description [string] : Add days to a date
29
+ on_test [script] :
30
+ tell ^^.d to now
31
+ tell ^^.future to now
32
+ tell ^^.future to add
33
+ eval ^^.future = ^^.d
34
+ refute "expected future date to be after current date"
35
+
36
+ subtract [test] :
37
+ description [string] : Subtract days from a date
38
+ on_test [script] :
39
+ tell ^^.d to now
40
+ tell ^^.future to now
41
+ tell ^^.future to sub
42
+ eval ^^.future = ^^.d
43
+ refute "expected past date to be before current date"
44
+
45
+ dd [test] :
46
+ description [string] : Get the day portion of a date
47
+ on_test [script] :
48
+ tell ^^.d to now
49
+ tell ^^.d to dd
50
+ eval it = ^^.d
51
+ refute "expected day to not be the same as the date"
52
+
53
+ mm [test] :
54
+ description [string] : Get the month portion of a date
55
+ on_test [script] :
56
+ tell ^^.d to now
57
+ tell ^^.d to mm
58
+ eval it = ^^.d
59
+ refute "expected month to not be the same as the date"
60
+
61
+ yy [test] :
62
+ description [string] : Get the year portion of a date
63
+ on_test [script] :
64
+ tell ^^.d to now
65
+ tell ^^.d to yy
66
+ eval it = ^^.d
67
+ refute "expected year to not be the same as the date"
68
+
69
+ yyyy [test] :
70
+ description [string] : Get the 4 digit year portion of a date
71
+ on_test [script] :
72
+ tell ^^.d to now
73
+ tell ^^.d to yyyy
74
+ eval ^^.d = it
75
+ refute "expected yyyy to not be the same as the date"
76
+
@@ -0,0 +1,76 @@
1
+ #
2
+ # Boolean tests
3
+ #
4
+
5
+ tests [can] :
6
+ dt [can] :
7
+ time [can] :
8
+
9
+ t [time] :
10
+ x [time] :
11
+ future [time] :
12
+
13
+ now [test] :
14
+ description [string] : Get the current time
15
+ on_test [script] :
16
+ check ^^.x for blank?
17
+ assert "expected new time to be blank"
18
+
19
+ tell ^^.x to now
20
+ check ^^.x for blank?
21
+ refute "expected time to not be blank"
22
+
23
+ tell ^^.t to now
24
+ eval ^^.t = ^^.x
25
+ assert "expected times to be equal"
26
+
27
+ add [test] :
28
+ description [string] : Add hours to a time
29
+ on_test [script] :
30
+ tell ^^.t to now
31
+ tell ^^.future to now
32
+ tell ^^.future to add
33
+ eval ^^.future = ^^.t
34
+ refute "expected future time to be after current time"
35
+
36
+ subtract [test] :
37
+ description [string] : Subtract hours from a time
38
+ on_test [script] :
39
+ tell ^^.t to now
40
+ tell ^^.future to now
41
+ tell ^^.future to sub
42
+ eval ^^.future = ^^.t
43
+ refute "expected past time to be before current time"
44
+
45
+ hh [test] :
46
+ description [string] : Get the hour portion of a time
47
+ on_test [script] :
48
+ tell ^^.t to now
49
+ tell ^^.t to hh
50
+ eval it = ^^.t
51
+ refute "expected hour to not be the same as the time"
52
+
53
+ mm [test] :
54
+ description [string] : Get the minute portion of a time
55
+ on_test [script] :
56
+ tell ^^.t to now
57
+ tell ^^.t to mm
58
+ eval it = ^^.t
59
+ refute "expected minute to not be the same as the time"
60
+
61
+ ss [test] :
62
+ description [string] : Get the second portion of a time
63
+ on_test [script] :
64
+ tell ^^.t to now
65
+ tell ^^.t to ss
66
+ eval it = ^^.t
67
+ refute "expected second to not be the same as the time"
68
+
69
+ am [test] :
70
+ description [string] : Get the am/pm portion of a time
71
+ on_test [script] :
72
+ tell ^^.t to now
73
+ tell ^^.t to am
74
+ eval it = ^^.t
75
+ refute "expected am/pm to not be the same as the time"
76
+
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: 5.2.0
4
+ version: 5.3.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: 2026-03-06 00:00:00.000000000 Z
11
+ date: 2026-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -416,6 +416,8 @@ files:
416
416
  - lib/gloo/verbs/wait.rb
417
417
  - lib/run.rb
418
418
  - test.gloo/basic.test.gloo
419
+ - test.gloo/dt/date.test.gloo
420
+ - test.gloo/dt/time.test.gloo
419
421
  - test.gloo/lang/gloo_sys.test.gloo
420
422
  - test.gloo/lang/ops.test.gloo
421
423
  - test.gloo/math/add.test.gloo