mores 0.1.1 → 0.1.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: c0eaf649383b24b4d70063e363ea1b7fb281bf2a
4
- data.tar.gz: 9afefc74edfc4af999700a95a27a16596e12b566
3
+ metadata.gz: ddeb8c2e355c1b4aac2e5327f14d743788f478e6
4
+ data.tar.gz: 619e001193d06a93af559d4f57351614760d16e7
5
5
  SHA512:
6
- metadata.gz: a45cb361ba5e5a111e4a55447bc518d5e0bb6975fe5cd5ecaa0bd5e7565adb303dbe4614e818d12cf331fac61a22fd00e9cc07ac25a450a327cf627e7eeb8538
7
- data.tar.gz: e41afe90866bd5169408e4156b76b4b4f9c9af294c7cdd6725f94322e1b269f634a445b236b524308776dc3797a997a0a17afc88d5525d8e09c4a2adf752cbb1
6
+ metadata.gz: 9a540d539229dae9c50f82e878be8991e58b25c7005ea23e9333500ce8161f370483f0c9d78d14567d822b1bd5d881f1f5ed430079b0714df568dba324e2ff3d
7
+ data.tar.gz: 43f53567481437e6e04c809a7e7ee6462f204ed9807a6bfb557510b7ebcd3719a80a46f74e3480fad265be958c49a47b3d878003bfd4e01f702dbd22e1439077
@@ -1,35 +1,39 @@
1
- module Mores::Chainable
2
- def self.included(mod)
3
- mod.extend ClassMethods
4
- end
5
-
6
- def **(chain)
7
- @__chain = chain
8
- self
9
- end
10
-
11
- private
1
+ module Mores
12
2
 
13
- def __chain
14
- @__chain ||= self.class.__send__(:__default_chain)
15
- end
3
+ module Chainable
4
+ def self.included(mod)
5
+ mod.extend ClassMethods
6
+ end
16
7
 
17
- module ClassMethods
18
- def chain(name, &block)
19
- __forwarder.__send__(:define_method, name) do |*args|
20
- __chain.public_send(name, *args)
21
- end
22
- __default_chain.define_singleton_method(name, block || proc { |*| })
8
+ def **(chain)
9
+ @__chain = chain
10
+ self
23
11
  end
24
12
 
25
13
  private
26
14
 
27
- def __forwarder
28
- @__forwarder ||= Module.new.tap { |m| include m }
15
+ def __chain
16
+ @__chain ||= self.class.__send__(:__default_chain).new
29
17
  end
30
18
 
31
- def __default_chain
32
- @@__default_chain ||= Object.new
19
+ module ClassMethods
20
+ def chain(name, &block)
21
+ __forwarder.__send__(:define_method, name) do |*args|
22
+ __chain.public_send(name, *args)
23
+ end
24
+ __default_chain.__send__(:define_method, name, block || proc { |*| })
25
+ end
26
+
27
+ private
28
+
29
+ def __forwarder
30
+ @__forwarder ||= superclass < Chainable ? superclass.__send__(:__forwarder) : Module.new.tap { |m| include m }
31
+ end
32
+
33
+ def __default_chain
34
+ @__default_chain ||= Class.new(superclass < Chainable ? superclass.__send__(:__default_chain) : Object)
35
+ end
33
36
  end
34
37
  end
38
+
35
39
  end
data/lib/mores/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mores
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mores
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Petter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-18 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler