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 +4 -4
- data/lib/mores/chainable.rb +28 -24
- data/lib/mores/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddeb8c2e355c1b4aac2e5327f14d743788f478e6
|
4
|
+
data.tar.gz: 619e001193d06a93af559d4f57351614760d16e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a540d539229dae9c50f82e878be8991e58b25c7005ea23e9333500ce8161f370483f0c9d78d14567d822b1bd5d881f1f5ed430079b0714df568dba324e2ff3d
|
7
|
+
data.tar.gz: 43f53567481437e6e04c809a7e7ee6462f204ed9807a6bfb557510b7ebcd3719a80a46f74e3480fad265be958c49a47b3d878003bfd4e01f702dbd22e1439077
|
data/lib/mores/chainable.rb
CHANGED
@@ -1,35 +1,39 @@
|
|
1
|
-
module Mores
|
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
|
-
|
14
|
-
|
15
|
-
|
3
|
+
module Chainable
|
4
|
+
def self.included(mod)
|
5
|
+
mod.extend ClassMethods
|
6
|
+
end
|
16
7
|
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
28
|
-
@
|
15
|
+
def __chain
|
16
|
+
@__chain ||= self.class.__send__(:__default_chain).new
|
29
17
|
end
|
30
18
|
|
31
|
-
|
32
|
-
|
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
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.
|
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-
|
11
|
+
date: 2016-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|