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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb6823bddd32058537a2ac74d0a01f02b9ddab02
4
- data.tar.gz: e0646664a04cbbd25c1ec0ec2e2e34aebb6c3b48
3
+ metadata.gz: 9fcd5faa7c6f70d9feb4bf4f35224cb20e83abf8
4
+ data.tar.gz: 869238abd8c00979d2f88337c5019fe78fc77d27
5
5
  SHA512:
6
- metadata.gz: b9759dcc7fb227a9128bc9f1ee429a74f47207483997a0bf302fa338b083a4c30bfe274d2099b42d2c161f1a6cd0f3f7fc95ba980aee43a211f67ffb06b9660c
7
- data.tar.gz: cdf877beb9b013b27390438e223b3e42983b8d53567ad7cea5bc301f9416a77cbd6c97c8ff3c213c303d9ef42b2b9a74bb501239fb868b82ed271ec825038eec
6
+ metadata.gz: b6d1ca3374aad8d8eb69115447d551b6eeb4e6ece4f9e75142969ed187c8dd6371a7c6975b280d66f796637a6b45ba06cc46ea3fd0a58fdaa18aa9491657c16c
7
+ data.tar.gz: 64206a894247af1b39fac13304c468a39e1a75d339bb249b0db35c6f28d0243abad19344e76c3d5309af98b955ec400d6d3d150e92197e7d5ca00f38b4aab800
@@ -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
 
@@ -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
- i_method_patch = patch_module(opt, "Ns#{snamespace}Class#{class_name}InstancePatch")
64
- c_method_patch = patch_module(opt, "Ns#{snamespace}Class#{class_name}ClassPatch")
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
@@ -1,3 +1,3 @@
1
1
  module Okuribito
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: okuribito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - muramurasan