okuribito 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/okuribito.rb +3 -30
- data/lib/okuribito/version.rb +1 -1
- 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: 9fcd5faa7c6f70d9feb4bf4f35224cb20e83abf8
|
4
|
+
data.tar.gz: 869238abd8c00979d2f88337c5019fe78fc77d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d1ca3374aad8d8eb69115447d551b6eeb4e6ece4f9e75142969ed187c8dd6371a7c6975b280d66f796637a6b45ba06cc46ea3fd0a58fdaa18aa9491657c16c
|
7
|
+
data.tar.gz: 64206a894247af1b39fac13304c468a39e1a75d339bb249b0db35c6f28d0243abad19344e76c3d5309af98b955ec400d6d3d150e92197e7d5ca00f38b4aab800
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# CHANGELOG
|
2
|
+
## [0.2.2](https://github.com/muramurasan/okuribito_rails/releases/tag/v0.2.2) (January 25, 2017)
|
3
|
+
* Fix: Stop confirming the existence of a namespace / class. #35
|
4
|
+
|
2
5
|
## [0.2.1](https://github.com/muramurasan/okuribito_rails/releases/tag/v0.2.1) (January 25, 2017)
|
3
6
|
* Fix: Assignment operator causes error #34
|
4
7
|
|
data/lib/okuribito.rb
CHANGED
@@ -51,17 +51,12 @@ module Okuribito
|
|
51
51
|
private
|
52
52
|
|
53
53
|
def patch_okuribito(full_class_name, observe_methods)
|
54
|
-
constants = full_class_name.split("::")
|
55
|
-
class_name = constants[-1]
|
56
|
-
return unless (namespace = constants_to_namespace(constants))
|
57
|
-
return unless defined_class?(namespace, class_name)
|
58
|
-
snamespace = namespace.to_s.gsub(/::/, "")
|
59
|
-
|
60
54
|
callback = @callback
|
61
55
|
opt ||= @opt
|
62
56
|
klass = full_class_name.constantize
|
63
|
-
|
64
|
-
|
57
|
+
uniq_constant = full_class_name.gsub(/::/, "Sp")
|
58
|
+
i_method_patch = patch_module(opt, "#{uniq_constant}InstancePatch")
|
59
|
+
c_method_patch = patch_module(opt, "#{uniq_constant}ClassPatch")
|
65
60
|
i_method_patched = 0
|
66
61
|
c_method_patched = 0
|
67
62
|
|
@@ -106,27 +101,5 @@ module Okuribito
|
|
106
101
|
Module.new.extend(SimplePatchModule)
|
107
102
|
end
|
108
103
|
end
|
109
|
-
|
110
|
-
def defined_namespace?(constants)
|
111
|
-
namespace = Object
|
112
|
-
constants.each do |constant|
|
113
|
-
return false unless namespace.const_defined?(constant)
|
114
|
-
namespace = "#{namespace}::#{constant}".constantize
|
115
|
-
end
|
116
|
-
true
|
117
|
-
end
|
118
|
-
|
119
|
-
def defined_class?(namespace, class_name)
|
120
|
-
namespace.const_defined?(class_name) && namespace.const_get(class_name).is_a?(Class)
|
121
|
-
end
|
122
|
-
|
123
|
-
def constants_to_namespace(constants)
|
124
|
-
if constants.size == 1
|
125
|
-
Object
|
126
|
-
else
|
127
|
-
return false unless defined_namespace?(constants[0..-2])
|
128
|
-
constants[0..-2].join("::").constantize
|
129
|
-
end
|
130
|
-
end
|
131
104
|
end
|
132
105
|
end
|
data/lib/okuribito/version.rb
CHANGED