rudash 2.13.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rudash/chain.rb +7 -0
- data/lib/rudash.rb +4 -0
- data/lib/utils/chain_wrapper.rb +21 -0
- data/lib/utils/dynamic_args_count.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0efde163ec32f1ae10522e24a34dc1d316a6b106db818e18760c86a4b95b53f
|
4
|
+
data.tar.gz: ff3255666168a904db28841d7f82ccc319dadc0c65054009e6b056c13b9a3927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99de8b06532e11d4f96c5a9ce64b96a9cd4a7dff105d8e61fed16472e8e49980cd7c59eef8b18d90522f2d8ef2a073752c069bdb2b2ce357d1f5fe989ae435f1
|
7
|
+
data.tar.gz: 6b9bbd93a29b3e4af5d423ec5a06b6d1052e52dd169b2ad65ab8d99a748ad2d357f295a60cb8fdaabc79e3273c8efc507441fbb72ee4ad7494335a1b0363503c
|
data/lib/rudash/chain.rb
ADDED
data/lib/rudash.rb
CHANGED
@@ -48,6 +48,9 @@ require_relative './rudash/range.rb'
|
|
48
48
|
require_relative './rudash/group_by.rb'
|
49
49
|
require_relative './rudash/take.rb'
|
50
50
|
require_relative './rudash/drop_right.rb'
|
51
|
+
require_relative './rudash/chain.rb'
|
52
|
+
|
53
|
+
require_relative './utils/chain_wrapper.rb'
|
51
54
|
|
52
55
|
# This is the exposed Gem class that contains all Rudash methods.
|
53
56
|
# New methods can use already implemented methods in the library by refering to "self"
|
@@ -103,4 +106,5 @@ class R_
|
|
103
106
|
extend Rudash::GroupBy
|
104
107
|
extend Rudash::Take
|
105
108
|
extend Rudash::DropRight
|
109
|
+
extend Rudash::Chain
|
106
110
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Rudash
|
2
|
+
module ChainUtils
|
3
|
+
class ChainWrapper
|
4
|
+
def initialize(value, r_)
|
5
|
+
@value = value
|
6
|
+
@r_ = r_
|
7
|
+
end
|
8
|
+
|
9
|
+
def value
|
10
|
+
@value
|
11
|
+
end
|
12
|
+
|
13
|
+
def method_missing(method_name, *args, &block)
|
14
|
+
result = @r_.public_send(method_name, @value, *args)
|
15
|
+
self.class.new(result, @r_)
|
16
|
+
rescue NameError
|
17
|
+
raise NameError.new("\"#{method_name}\" doesn't exist in Rudash")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Islam Attrash
|
@@ -19,6 +19,7 @@ files:
|
|
19
19
|
- lib/rudash.rb
|
20
20
|
- lib/rudash/at.rb
|
21
21
|
- lib/rudash/capitalize.rb
|
22
|
+
- lib/rudash/chain.rb
|
22
23
|
- lib/rudash/compact.rb
|
23
24
|
- lib/rudash/concat.rb
|
24
25
|
- lib/rudash/curry.rb
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- lib/rudash/uniq.rb
|
68
69
|
- lib/rudash/update.rb
|
69
70
|
- lib/rudash/without.rb
|
71
|
+
- lib/utils/chain_wrapper.rb
|
70
72
|
- lib/utils/dynamic_args_count.rb
|
71
73
|
- lib/utils/index.rb
|
72
74
|
- lib/utils/nested_path_creator.rb
|