kungfuig 0.4.1 → 0.4.2

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: 69f461e7748885c43f77aa5ea2d1635b825f4cd2
4
- data.tar.gz: 6bebc1fbf07394c0af30c7c44ea1cefff3d0a75a
3
+ metadata.gz: 7209ee253dbd083df7df4be1c0596cf3be0b45eb
4
+ data.tar.gz: 9cb680779c32389e770bceb047b4440c5e39c423
5
5
  SHA512:
6
- metadata.gz: 2976c6c64585dd06ae78443f2f0b480cb0dae0b0880d2cd5361efceee268de50a108c6c3562b0aef86da001d04f47d58048bedf585d1f7f77039e601c7bb9370
7
- data.tar.gz: 67e7a375acdee7ec04b24794c4a6520949d03d7443a9056d28ab27e8d22a869927eea7dc4dd9188198b8626c7d363b73431972017982722a226d61a1b5b1f9ec
6
+ metadata.gz: 37ce51cdf63d82c08b78305427e23b1c6721533e5486bc7416ab9d9f3cf774b5fabf74af09c35b3385f0371a4c5c818c35e07b7f3c180e7c825d4411f93f3846
7
+ data.tar.gz: 654e3a115be6951f928a4e56441668eaad7b3f49f224dd3ee5f463a4eb2b5fbfb1c8098c5bb48daeb783c8a5e18132caa16b53b645a6467c872d63a635b5b08e
@@ -1 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
+
3
+ Style/AsciiComments:
4
+ Exclude:
5
+ - 'lib/**/*'
6
+ - 'spec/**/*'
7
+
8
+ Style/RaiseArgs:
9
+ Exclude:
10
+ - 'lib/**/*'
@@ -124,11 +124,11 @@ module Kungfuig
124
124
 
125
125
  aspects(meth)[after ? :after : :before] << Proc.new
126
126
 
127
- unless instance_methods(true).include?(:"#{ASPECT_PREFIX}#{meth}")
127
+ unless instance_methods.include?(:"#{ASPECT_PREFIX}#{meth}")
128
128
  class_eval <<-CODE
129
129
  alias_method :#{ASPECT_PREFIX}#{meth}, :#{meth}
130
130
  def #{meth}(*args, &cb)
131
- ps = self.class.aspects(:#{meth})
131
+ ps = self.class.aspects(:#{meth}).merge((class << self; self; end).aspects(:#{meth})) { |_, c, ec| c | ec }
132
132
  ps[:before].each do |p|
133
133
  p.call(*args) # TODO: make prependers able to change args!!!
134
134
  end
@@ -11,15 +11,17 @@ module Kungfuig
11
11
  case
12
12
  when v.empty? then []
13
13
  when v.include?(:'*') then klazz.instance_methods(false)
14
- else klazz.instance_methods(false) & v
14
+ else klazz.instance_methods & v
15
15
  end
16
16
  end.reduce(&:-)
17
17
  end
18
18
  end
19
19
 
20
- def attach(klazz, before: nil, after: nil, exclude: nil)
20
+ def attach(to, before: nil, after: nil, exclude: nil)
21
21
  raise ArgumentError, "Trying to attach nothing to #{klazz}. I need a block!" unless block_given?
22
22
 
23
+ klazz = to.is_a?(Class) ? to : class << to; self; end # attach to klazz’s eigenclass if object given
24
+
23
25
  klazz.send(:include, Kungfuig::Aspector) unless klazz.ancestors.include? Kungfuig::Aspector
24
26
  cb = Proc.new
25
27
 
@@ -1,3 +1,3 @@
1
1
  module Kungfuig
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kungfuig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kantox LTD