where_is_waldo 0.1.7 → 0.1.8

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: 0daa39b5301b15f20943db48e10565bb18c7a33e12917551d6f9bea954311e20
4
- data.tar.gz: 4ffb5a45341e48e9d4bc5f8dd08c9cf5a970dc0939de4e6e869d8a8bfa14c99b
3
+ metadata.gz: 14d08eaaa5203c578066b674469638145e6bd1a095260ba5874a78e7299b2ab3
4
+ data.tar.gz: 7a96f733e8dd421884e0bd798f38b5f5de128faaf1eff0fc7126c2f29b556dd0
5
5
  SHA512:
6
- metadata.gz: 59dfa8c1cfb8c29b53dde974da7db16a3f8c16fd4ba24e7adcf1dedac260ec6bad7618d718e161dd7d11b466a3f06b87a8168cabaf0deabeca21c0d00ae71ba0
7
- data.tar.gz: 27ad4732f42cc5257c1c9f39cbff46a6d21570e1c7c8fb695da6a9caabdf9ff92742f3e82633b793dfdce786beff64e8933839be6c3d850b5465d31326a86859
6
+ metadata.gz: e5a08ff00777508b95e44767dffc2bb24c0efa7a17a62dddb4386a83a07a222847da426000cc61ec166c177afdf8caec51b4fadd67351db775f96a09579e7d75
7
+ data.tar.gz: b6268730110e341d4f518899ccc57d1bf4f82c39cdb82ff21e6b8ea4beaa1a3739770f4d8d32995d1969174249d61815de13bb8fb1114c793727a86c723e901c
data/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  Notable changes to where_is_waldo. Format loosely follows
4
4
  [Keep a Changelog](https://keepachangelog.com/).
5
5
 
6
+ ## 0.1.8
7
+
8
+ ### Fixed
9
+
10
+ - **`WhereIsWaldo.subject_online?`, `.sessions_for_subject`, `.session_status`
11
+ no longer raise `uninitialized constant` when called.** These three methods
12
+ were defined with ActiveSupport's `delegate :method, to: :PresenceService`
13
+ inside a `class << self` block. `delegate` generates the method body via
14
+ `class_eval` with a **string**, and a string-eval'd body's `Module.nesting`
15
+ is just the target class — for the WhereIsWaldo module's singleton class,
16
+ that's `[#<Class:WhereIsWaldo>]`, *without* the enclosing `WhereIsWaldo`.
17
+ Constant lookup for `PresenceService` inside the generated method then
18
+ couldn't walk up to the enclosing module and failed with:
19
+
20
+ ```
21
+ uninitialized constant #<Class:WhereIsWaldo>::PresenceService (NameError)
22
+ ```
23
+
24
+ Replaced the three `delegate` calls with plain `def` methods matching the
25
+ pattern of the other class methods on the module (`.connect`, `.online`,
26
+ `.online_ids`, `.cleanup`, etc.), which inherit the correct lexical scope
27
+ and resolve `PresenceService` as `WhereIsWaldo::PresenceService`.
28
+
29
+ Waldo's own internal code (`PresenceChannel`, `Roster`) references
30
+ `PresenceService` at its fully-qualified name from correctly-scoped
31
+ modules, so this bug never affected the actual presence flow — only host
32
+ code that calls the top-level convenience wrappers. Affects every
33
+ released version up to and including `0.1.7`.
34
+
35
+ ### Tests
36
+
37
+ - Added `spec/where_is_waldo_spec.rb` exercising every top-level convenience
38
+ method at the public boundary — the only place a `class_eval`-scope
39
+ regression in the wrapper can be caught, since internal callers bypass it.
40
+
6
41
  ## 0.1.7
7
42
 
8
43
  ### Added
data/README.md CHANGED
@@ -238,7 +238,8 @@ See `docs/PRESENCE_ROSTER_PLAN.md` for the full mode matrix and tradeoffs.
238
238
  their live sessions (multiple browser tabs, mobile, etc.):
239
239
 
240
240
  ```
241
- { id: 7, status: "active", devices: { web: "idle", mobile: "active" } }
241
+ { id: 7, status: "active", devices: { web: "idle", mobile: "active" },
242
+ last_activity: "2026-07-27T15:23:04Z" }
242
243
  ```
243
244
 
244
245
  - `status` — highest activity across devices (the "active anywhere?" answer):
@@ -248,6 +249,11 @@ their live sessions (multiple browser tabs, mobile, etc.):
248
249
  - `offline` — no live sessions
249
250
  - `devices[platform]` — that platform's own status (answers "active on
250
251
  **mobile**?" vs. "active at all?").
252
+ - `last_activity` — ISO8601 timestamp of the most recent input across **all**
253
+ the subject's live sessions (`null` when offline). The roster only
254
+ broadcasts on `status` transitions, so subtract against your own clock to
255
+ derive seconds-idle and apply client-side thresholds without a server
256
+ `timeout` change: `(Date.now() - new Date(m.last_activity)) / 1000`.
251
257
 
252
258
  #### Configure
253
259
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -55,11 +55,25 @@ module WhereIsWaldo
55
55
  PresenceService.all_online_ids(timeout: timeout)
56
56
  end
57
57
 
58
- delegate :subject_online?, to: :PresenceService
58
+ # NOTE: don't use ActiveSupport's `delegate` here. `delegate` generates
59
+ # the method via `class_eval` with a STRING, and a string-eval'd body's
60
+ # `Module.nesting` is just the target class — for a `class << self` inside
61
+ # `module WhereIsWaldo`, that's `[#<Class:WhereIsWaldo>]`, WITHOUT
62
+ # `WhereIsWaldo` itself. Constant lookup for `PresenceService` inside the
63
+ # generated method then can't walk up to the enclosing module and raises
64
+ # `uninitialized constant #<Class:WhereIsWaldo>::PresenceService`. A plain
65
+ # `def` inherits the enclosing lexical nesting and resolves correctly.
66
+ def subject_online?(...)
67
+ PresenceService.subject_online?(...)
68
+ end
59
69
 
60
- delegate :sessions_for_subject, to: :PresenceService
70
+ def sessions_for_subject(...)
71
+ PresenceService.sessions_for_subject(...)
72
+ end
61
73
 
62
- delegate :session_status, to: :PresenceService
74
+ def session_status(...)
75
+ PresenceService.session_status(...)
76
+ end
63
77
 
64
78
  def cleanup(timeout: nil)
65
79
  PresenceService.cleanup(timeout: timeout)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_is_waldo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Gibson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-27 00:00:00.000000000 Z
11
+ date: 2026-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails