elastic-apm 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of elastic-apm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/elastic-apm.gemspec +1 -1
- data/lib/elastic_apm/injectors.rb +2 -2
- data/lib/elastic_apm/util/inflector.rb +59 -0
- data/lib/elastic_apm/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8b4212fe43613decb50e73909c38c9188e5a57d02859ae40164d53e238fe539
|
4
|
+
data.tar.gz: 92fd6e982456dfd3aca127b1342e4dca73c2921f38c2deb5faa885f3706735a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3fcacd80cc3050c3aec21542f9130c5bf9cdffa7d128fd1d88fe4bd46ab8276ecabddc818b37549b46da9f4f7fc73f66ef4b708c330ffb7b99a2c6ab71b88d
|
7
|
+
data.tar.gz: 32ebd78d8c1368b4177f376d1455f3e67576b91ddf9db61072450172c3d536b18929fb320179f7362344f9977fa7d42380b2d72d6eaaa7c4f94f5fa99b9ba10b
|
data/elastic-apm.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = 'https://github.com/elastic/apm-agent-ruby'
|
13
13
|
spec.metadata = { 'source_code_uri' => 'https://github.com/elastic/apm-agent-ruby' }
|
14
14
|
spec.license = 'Apache-2.0'
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 2.2.0"
|
16
16
|
|
17
17
|
spec.add_dependency('activesupport', '>= 3.0.0')
|
18
18
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'elastic_apm/util/inflector'
|
4
4
|
|
5
5
|
module ElasticAPM
|
6
6
|
# @api private
|
@@ -46,7 +46,7 @@ module ElasticAPM
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.const_defined?(const_name)
|
49
|
-
const =
|
49
|
+
const = Util::Inflector.constantize(const_name)
|
50
50
|
!!const
|
51
51
|
rescue NameError
|
52
52
|
false
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module ElasticAPM
|
2
|
+
module Util
|
3
|
+
# @api private
|
4
|
+
module Inflector
|
5
|
+
# rubocop:disable all
|
6
|
+
# From https://github.com/rails/rails/blob/861b70e92f4a1fc0e465ffcf2ee62680519c8f6f/activesupport/lib/active_support/inflector/methods.rb#L249
|
7
|
+
#
|
8
|
+
# Tries to find a constant with the name specified in the argument string.
|
9
|
+
#
|
10
|
+
# 'Module'.constantize # => Module
|
11
|
+
# 'Test::Unit'.constantize # => Test::Unit
|
12
|
+
#
|
13
|
+
# The name is assumed to be the one of a top-level constant, no matter
|
14
|
+
# whether it starts with "::" or not. No lexical context is taken into
|
15
|
+
# account:
|
16
|
+
#
|
17
|
+
# C = 'outside'
|
18
|
+
# module M
|
19
|
+
# C = 'inside'
|
20
|
+
# C # => 'inside'
|
21
|
+
# 'C'.constantize # => 'outside', same as ::C
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# NameError is raised when the name is not in CamelCase or the constant is
|
25
|
+
# unknown.
|
26
|
+
def self.constantize(camel_cased_word)
|
27
|
+
names = camel_cased_word.split('::')
|
28
|
+
|
29
|
+
# Trigger a built-in NameError exception including the ill-formed constant in the message.
|
30
|
+
Object.const_get(camel_cased_word) if names.empty?
|
31
|
+
|
32
|
+
# Remove the first blank element in case of '::ClassName' notation.
|
33
|
+
names.shift if names.size > 1 && names.first.empty?
|
34
|
+
|
35
|
+
names.inject(Object) do |constant, name|
|
36
|
+
if constant == Object
|
37
|
+
constant.const_get(name)
|
38
|
+
else
|
39
|
+
candidate = constant.const_get(name)
|
40
|
+
next candidate if constant.const_defined?(name, false)
|
41
|
+
next candidate unless Object.const_defined?(name)
|
42
|
+
|
43
|
+
# Go down the ancestors to check if it is owned directly. The check
|
44
|
+
# stops when we reach Object or the end of ancestors tree.
|
45
|
+
constant = constant.ancestors.inject do |const, ancestor|
|
46
|
+
break const if ancestor == Object
|
47
|
+
break ancestor if ancestor.const_defined?(name, false)
|
48
|
+
const
|
49
|
+
end
|
50
|
+
|
51
|
+
# owner is in Object, so raise
|
52
|
+
constant.const_get(name, false)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
# rubocop:enable all
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/elastic_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/elastic_apm/transaction.rb
|
107
107
|
- lib/elastic_apm/util.rb
|
108
108
|
- lib/elastic_apm/util/dig.rb
|
109
|
+
- lib/elastic_apm/util/inflector.rb
|
109
110
|
- lib/elastic_apm/util/inspector.rb
|
110
111
|
- lib/elastic_apm/util/lru_cache.rb
|
111
112
|
- lib/elastic_apm/version.rb
|
@@ -124,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
125
|
requirements:
|
125
126
|
- - ">="
|
126
127
|
- !ruby/object:Gem::Version
|
127
|
-
version: 2.
|
128
|
+
version: 2.2.0
|
128
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
130
|
requirements:
|
130
131
|
- - ">="
|