okuribito 0.2.2 → 0.2.3
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 +25 -0
- data/lib/okuribito.rb +5 -0
- data/lib/okuribito/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c86eaef77f4c3b58eea32fad2807357ef3283d3
|
|
4
|
+
data.tar.gz: a1917f0eecd807c567fd710cc422a52107c5500d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a1c28a5e844c0ceb2b978ca1cc030ca233021249e7a7b1cf8a1218ae8cb05e5825a09fb846e82005a1c89bb7ae7df2c12f6b01c9ddce50d13de9160bf3f094a
|
|
7
|
+
data.tar.gz: e4800ed07e2903fb9b570a657303db012483663b4a44cd33a9412a75093943148401a380c6299366e6497f8a94ccfcc16e66e6b494cf0708713ade80e1fb6dba
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
|
+
## [0.2.3](https://github.com/muramurasan/okuribito_rails/releases/tag/v0.2.3) (February 5, 2017)
|
|
3
|
+
* Feature: Monitor a single method with a string specification.
|
|
4
|
+
* Feature: Make arguments referable when executing code.
|
|
5
|
+
|
|
2
6
|
## [0.2.2](https://github.com/muramurasan/okuribito_rails/releases/tag/v0.2.2) (January 25, 2017)
|
|
3
7
|
* Fix: Stop confirming the existence of a namespace / class. #35
|
|
4
8
|
|
data/README.md
CHANGED
|
@@ -65,6 +65,31 @@ end
|
|
|
65
65
|
okuribito.apply("config/okuribito.yml")
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
You can also monitor a single method with a string specification.
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
okuribito = Okuribito::OkuribitoPatch.new do |method_name, obj_name, caller_info|
|
|
72
|
+
# do something as you like!
|
|
73
|
+
end
|
|
74
|
+
okuribito.apply("TestTarget#deprecated_method")
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You can use the following parameters when executing arbitrary code.
|
|
78
|
+
|
|
79
|
+
* method_name
|
|
80
|
+
* obj_name
|
|
81
|
+
* caller_info (backtrace)
|
|
82
|
+
* class_name
|
|
83
|
+
* symbol (`.` or `#`)
|
|
84
|
+
* args
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
okuribito = Okuribito::OkuribitoPatch.new do |method_name, obj_name, caller_info, class_name, symbol, args|
|
|
88
|
+
# do something as you like!
|
|
89
|
+
end
|
|
90
|
+
okuribito.apply("TestTarget#deprecated_method_with_args")
|
|
91
|
+
```
|
|
92
|
+
|
|
68
93
|
### ex: Ruby On Rails
|
|
69
94
|
|
|
70
95
|
Edit `application.rb`
|
data/lib/okuribito.rb
CHANGED
|
@@ -48,6 +48,11 @@ module Okuribito
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
def apply_one(full_method_name)
|
|
52
|
+
class_name, symbol, method_name = full_method_name.split(/(\.|#)/)
|
|
53
|
+
patch_okuribito(class_name, [symbol + method_name])
|
|
54
|
+
end
|
|
55
|
+
|
|
51
56
|
private
|
|
52
57
|
|
|
53
58
|
def patch_okuribito(full_class_name, observe_methods)
|
data/lib/okuribito/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: okuribito
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- muramurasan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-02-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|