kantox-chronoscope 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kantox/chronoscope/version.rb +1 -1
- data/lib/kantox/chronoscope.rb +16 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6d28754b2595ecfc31f595f08474d07405c8ddf
|
4
|
+
data.tar.gz: 90b19750de99c9b317c59d53ceb850234aaa07f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a530d3ecc287e92acc653f09a494c20c5c937c7f8800f448c742f0d08e387175c29f6ee2d11a7070f32056fe7f44ff62178fa39361f3d59e65a567bfc86f8ab5
|
7
|
+
data.tar.gz: ec9614646ce1dcafb53df11419b53bfc3c436ee825a864bd1b457017ca201d41f77f29c42aadf72cbb3664ced19e1c7a2466df3593df349e831a9f1a6121a687
|
data/lib/kantox/chronoscope.rb
CHANGED
@@ -10,6 +10,8 @@ module Kantox
|
|
10
10
|
module Generic; end
|
11
11
|
module Dummy; end
|
12
12
|
|
13
|
+
CHAIN_PREFIX = '⚑'
|
14
|
+
|
13
15
|
DEFAULT_ENV = :development
|
14
16
|
CONFIG_LOCATION = 'config/chronoscope.yml'.freeze
|
15
17
|
|
@@ -34,6 +36,10 @@ module Kantox
|
|
34
36
|
end
|
35
37
|
chronoscope.inject(general_config.top)
|
36
38
|
|
39
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
40
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
41
|
+
# rubocop:disable Metrics/AbcSize
|
42
|
+
# rubocop:disable Metrics/MethodLength
|
37
43
|
module ClassMethods
|
38
44
|
# `methods` parameter accepts:
|
39
45
|
# none for all instance methods
|
@@ -43,13 +49,15 @@ module Kantox
|
|
43
49
|
methods = klazz.instance_methods(false) if methods.empty?
|
44
50
|
|
45
51
|
methods.each do |m|
|
46
|
-
next if m.to_s =~ /\A
|
52
|
+
next if m.to_s =~ /\A#{CHAIN_PREFIX}/ # skip wrappers
|
53
|
+
next if m.to_s.end_with?('=') # skip attr_writers # FIXME: WTF?????
|
54
|
+
next if methods.include?("#{CHAIN_PREFIX}#{m}".to_sym) # skip already wrapped functions
|
47
55
|
next if (klazz.instance_method(m).parameters.to_h[:block] rescue false) # FIXME: report
|
48
56
|
|
49
57
|
klazz.class_eval %Q|
|
50
|
-
alias_method '
|
51
|
-
def #{m}
|
52
|
-
⌚('#{klazz}##{m}') {
|
58
|
+
alias_method :'#{CHAIN_PREFIX}#{m}', :'#{m}'
|
59
|
+
def #{m}(*args)
|
60
|
+
⌚('#{klazz}##{m}') { #{CHAIN_PREFIX}#{m} *args }
|
53
61
|
end
|
54
62
|
|
|
55
63
|
end
|
@@ -57,6 +65,10 @@ module Kantox
|
|
57
65
|
# FIXME: report
|
58
66
|
end
|
59
67
|
end
|
68
|
+
# rubocop:enable Metrics/MethodLength
|
69
|
+
# rubocop:enable Metrics/AbcSize
|
70
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
71
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
60
72
|
extend ClassMethods
|
61
73
|
end
|
62
74
|
end
|