ruby-ray 0.3.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/examples/caller.rb +16 -0
- data/examples/trace.rb +16 -0
- data/lib/ray.rb +27 -0
- data/lib/ray/payloads/caller_payload.rb +25 -0
- data/lib/ray/payloads/trace_payload.rb +27 -0
- data/lib/ray/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06e49e57ed9d6b34fbf06a37ce0e63aca51f9dff82e9d7d8b48d7b41d872d331
|
4
|
+
data.tar.gz: 8deb4a2dfabbf97198ddeeae00d92a48b64232d58c51fe8ca33c26692e817598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d03d3e056d54129294666a564d3c0047ff8682d5f66bb438daeb8450ba217d09dd762844c802dc2b2dfc991ec7e4cef4f460b0ecef04e90b1bb84a29b86f0e0
|
7
|
+
data.tar.gz: 6fc8cc20627f4fbce495b698cdd066a517bc40efa8d28e24548170d353cccc0f6ad05007ba152cb77fdf9adb0bdf3c5ed33dee41352281b1de7d8e76a9f8c27e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ Please review [our security policy](../../security/policy) on how to report secu
|
|
36
36
|
- [Freek Van der Herten](https://github.com/freekmurze)
|
37
37
|
- [All Contributors](../../contributors)
|
38
38
|
|
39
|
-
A big thank you to Chris Oliver for
|
39
|
+
A big thank you to Chris Oliver for developing the initial gem. You can watch the stream [in this video](https://freek.dev/1904-creating-a-ruby-gem-for-ray).
|
40
40
|
|
41
41
|
## License
|
42
42
|
|
data/examples/caller.rb
ADDED
data/examples/trace.rb
ADDED
data/lib/ray.rb
CHANGED
@@ -23,6 +23,11 @@ require_relative "ray/payloads/notify_payload"
|
|
23
23
|
require_relative "ray/payloads/create_lock_payload"
|
24
24
|
require_relative "ray/payloads/size_payload"
|
25
25
|
require_relative "ray/payloads/json_string_payload"
|
26
|
+
require_relative "ray/payloads/caller_payload"
|
27
|
+
require_relative "ray/payloads/trace_payload"
|
28
|
+
|
29
|
+
require_relative "ray/origin/origin_factory"
|
30
|
+
|
26
31
|
|
27
32
|
module Ray
|
28
33
|
class Ray
|
@@ -119,6 +124,28 @@ module Ray
|
|
119
124
|
send_custom(anything.class.to_s, 'Class name')
|
120
125
|
end
|
121
126
|
|
127
|
+
def caller
|
128
|
+
location = caller_locations[1]
|
129
|
+
|
130
|
+
if (! location)
|
131
|
+
payload = Payloads::CustomPayload.new('Called at top level', 'Caller')
|
132
|
+
|
133
|
+
send_request payload
|
134
|
+
|
135
|
+
return self
|
136
|
+
end
|
137
|
+
|
138
|
+
payload = Payloads::CallerPayload.new(location)
|
139
|
+
|
140
|
+
send_request payload
|
141
|
+
end
|
142
|
+
|
143
|
+
def trace
|
144
|
+
payload = Payloads::TracePayload.new caller_locations
|
145
|
+
|
146
|
+
send_request payload
|
147
|
+
end
|
148
|
+
|
122
149
|
def to_json(*args)
|
123
150
|
payloads = args.map do |arg|
|
124
151
|
Payloads::JsonStringPayload.new(arg)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Ray
|
2
|
+
module Payloads
|
3
|
+
class CallerPayload < Payload
|
4
|
+
|
5
|
+
def initialize(location)
|
6
|
+
@location = location
|
7
|
+
end
|
8
|
+
|
9
|
+
def type
|
10
|
+
'caller'
|
11
|
+
end
|
12
|
+
|
13
|
+
def content
|
14
|
+
{
|
15
|
+
frame: {
|
16
|
+
file_name: @location.absolute_path,
|
17
|
+
line_number: @location.lineno,
|
18
|
+
vendor_frame: false,
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Ray
|
2
|
+
module Payloads
|
3
|
+
class TracePayload < Payload
|
4
|
+
|
5
|
+
def initialize(locations)
|
6
|
+
@locations = locations
|
7
|
+
end
|
8
|
+
|
9
|
+
def type
|
10
|
+
'trace'
|
11
|
+
end
|
12
|
+
|
13
|
+
def content
|
14
|
+
frames = @locations.map do |location|
|
15
|
+
{
|
16
|
+
file_name: location.absolute_path,
|
17
|
+
line_number: location.lineno,
|
18
|
+
vendor_frame: false,
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
{ frames: frames }
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/ray/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-ray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Freek Van der Herten
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-02-
|
12
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- Rakefile
|
44
44
|
- bin/console
|
45
45
|
- bin/setup
|
46
|
+
- examples/caller.rb
|
46
47
|
- examples/class_name.rb
|
47
48
|
- examples/colors.rb
|
48
49
|
- examples/custom.rb
|
@@ -53,6 +54,7 @@ files:
|
|
53
54
|
- examples/notify.rb
|
54
55
|
- examples/pause.rb
|
55
56
|
- examples/size.rb
|
57
|
+
- examples/trace.rb
|
56
58
|
- examples/visibility.rb
|
57
59
|
- lib/ray.rb
|
58
60
|
- lib/ray/client.rb
|
@@ -61,6 +63,7 @@ files:
|
|
61
63
|
- lib/ray/origin/origin_factory.rb
|
62
64
|
- lib/ray/payload_factory.rb
|
63
65
|
- lib/ray/payloads/bool_payload.rb
|
66
|
+
- lib/ray/payloads/caller_payload.rb
|
64
67
|
- lib/ray/payloads/color_payload.rb
|
65
68
|
- lib/ray/payloads/create_lock_payload.rb
|
66
69
|
- lib/ray/payloads/custom_payload.rb
|
@@ -76,6 +79,7 @@ files:
|
|
76
79
|
- lib/ray/payloads/show_app_payload.rb
|
77
80
|
- lib/ray/payloads/size_payload.rb
|
78
81
|
- lib/ray/payloads/string_payload.rb
|
82
|
+
- lib/ray/payloads/trace_payload.rb
|
79
83
|
- lib/ray/request.rb
|
80
84
|
- lib/ray/version.rb
|
81
85
|
- ray.gemspec
|