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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fcd5faa7c6f70d9feb4bf4f35224cb20e83abf8
4
- data.tar.gz: 869238abd8c00979d2f88337c5019fe78fc77d27
3
+ metadata.gz: 3c86eaef77f4c3b58eea32fad2807357ef3283d3
4
+ data.tar.gz: a1917f0eecd807c567fd710cc422a52107c5500d
5
5
  SHA512:
6
- metadata.gz: b6d1ca3374aad8d8eb69115447d551b6eeb4e6ece4f9e75142969ed187c8dd6371a7c6975b280d66f796637a6b45ba06cc46ea3fd0a58fdaa18aa9491657c16c
7
- data.tar.gz: 64206a894247af1b39fac13304c468a39e1a75d339bb249b0db35c6f28d0243abad19344e76c3d5309af98b955ec400d6d3d150e92197e7d5ca00f38b4aab800
6
+ metadata.gz: 6a1c28a5e844c0ceb2b978ca1cc030ca233021249e7a7b1cf8a1218ae8cb05e5825a09fb846e82005a1c89bb7ae7df2c12f6b01c9ddce50d13de9160bf3f094a
7
+ data.tar.gz: e4800ed07e2903fb9b570a657303db012483663b4a44cd33a9412a75093943148401a380c6299366e6497f8a94ccfcc16e66e6b494cf0708713ade80e1fb6dba
@@ -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`
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Okuribito
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.2.3".freeze
3
3
  end
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.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-01-25 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport