expendables 0.0.2 → 0.0.3
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 +4 -4
- data/lib/expendables/nil.rb +5 -0
- data/lib/expendables/proc.rb +10 -0
- data/lib/expendables/symbol/compose.rb +6 -0
- data/lib/expendables/symbol/to_proc_with_args.rb +12 -2
- data/lib/expendables/symbol.rb +1 -0
- data/lib/expendables/version.rb +1 -1
- data/lib/expendables.rb +2 -2
- data/spec/expendables_spec.rb +16 -0
- metadata +7 -12
- data/lib/expendables/comparable/alias_less_more.rb +0 -4
- data/lib/expendables/comparable.rb +0 -1
- data/lib/expendables/kernel/less_more.rb +0 -12
- data/lib/expendables/kernel.rb +0 -1
- data/spec/comparable_spec.rb +0 -10
- data/spec/kernel_spec.rb +0 -10
- data/spec/symbol_spec.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35858052c343fb349fbfa85632b85a0000d7c342
|
4
|
+
data.tar.gz: 8e213e71cd657362137a8ce8fd69aa1e4e026fd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ebd612176ef17ff3a210f5d3cefbcfdc134ae0267cbe25c5068256cd90920693f45ef94dec6a759a3086616966a1abe6001eade2bbafcda8e8710e1378f749
|
7
|
+
data.tar.gz: 774ab18aeb7db25417129da84f4b19496814ace3ebe03776f8e6b365c97cf6c07a4d986c1722e646c25ede7d24820e3a672150ef151bfd79c0661ccd7135d61e
|
@@ -1,5 +1,15 @@
|
|
1
1
|
class Symbol
|
2
|
-
def
|
3
|
-
|
2
|
+
def +@
|
3
|
+
self.to_proc
|
4
4
|
end
|
5
|
+
|
6
|
+
def to_proc_with_args(*static_args, &static_block)
|
7
|
+
Proc.new do |*proc_args, &proc_block|
|
8
|
+
receiver = proc_args.shift
|
9
|
+
block = (+static_block >> +proc_block)
|
10
|
+
to_proc_without_args.call(receiver, *static_args, *proc_args, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
alias_method :to_proc_without_args, :to_proc
|
14
|
+
alias_method :to_proc, :to_proc_with_args
|
5
15
|
end
|
data/lib/expendables/symbol.rb
CHANGED
data/lib/expendables/version.rb
CHANGED
data/lib/expendables.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
require "expendables"
|
4
|
+
|
5
|
+
class A
|
6
|
+
def b(c, d, e, f)
|
7
|
+
c + d + e + f
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Symbol do
|
12
|
+
it { :+.to_proc(3).call(4).must_equal 7 }
|
13
|
+
it { :b.to_proc(1,2).call(A.new, 3, 4).must_equal 10 }
|
14
|
+
|
15
|
+
it { :+[3].call(4).must_equal 7 }
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expendables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eido NABESHIMA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,18 +52,15 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- expendables.gemspec
|
54
54
|
- lib/expendables.rb
|
55
|
-
- lib/expendables/
|
56
|
-
- lib/expendables/
|
57
|
-
- lib/expendables/kernel.rb
|
58
|
-
- lib/expendables/kernel/less_more.rb
|
55
|
+
- lib/expendables/nil.rb
|
56
|
+
- lib/expendables/proc.rb
|
59
57
|
- lib/expendables/symbol.rb
|
60
58
|
- lib/expendables/symbol/alias_to_proc.rb
|
59
|
+
- lib/expendables/symbol/compose.rb
|
61
60
|
- lib/expendables/symbol/to_proc_with_args.rb
|
62
61
|
- lib/expendables/version.rb
|
63
|
-
- spec/
|
64
|
-
- spec/kernel_spec.rb
|
62
|
+
- spec/expendables_spec.rb
|
65
63
|
- spec/spec_helper.rb
|
66
|
-
- spec/symbol_spec.rb
|
67
64
|
homepage: ''
|
68
65
|
licenses:
|
69
66
|
- MIT
|
@@ -89,8 +86,6 @@ signing_key:
|
|
89
86
|
specification_version: 4
|
90
87
|
summary: Strong power for Ruby.
|
91
88
|
test_files:
|
92
|
-
- spec/
|
93
|
-
- spec/kernel_spec.rb
|
89
|
+
- spec/expendables_spec.rb
|
94
90
|
- spec/spec_helper.rb
|
95
|
-
- spec/symbol_spec.rb
|
96
91
|
has_rdoc:
|
@@ -1 +0,0 @@
|
|
1
|
-
require "expendables/comparable/alias_less_more"
|
data/lib/expendables/kernel.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "expendables/kernel/less_more"
|
data/spec/comparable_spec.rb
DELETED
data/spec/kernel_spec.rb
DELETED