to_proc 0.0.2 → 0.0.3

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: 26e32799d86106d07c04df61e0f233424abaa594
4
- data.tar.gz: 16d7bbd701584993d6b90d40bc1c5bc9aef2d2a4
3
+ metadata.gz: 97dcc654333dbb220da9246cf7ad391126cb58ce
4
+ data.tar.gz: 93e039db6b1093ac7eb2af1ac7c69e2177271c58
5
5
  SHA512:
6
- metadata.gz: b09b963ca2506360ca7635f24bba6f9eb262a7ad215104bb390a085387b2829a72eb56648f6c271150b4c8eede6ec1b43919929b7d122d30aed1ac178447efa4
7
- data.tar.gz: 53b19f2614fc30b13fbf32e875a712357a5474b9761331c97b7a42f9a6d368f754e1a376ee2ae06bdb2a539b6c16482961c817473089506e4fc6ba59813e6039
6
+ metadata.gz: 1feb41290a03434644dfc1ddcd23e29426c4ecdb7be3d75142dd70cafdd29830f7ac9c727a5228d3f3f8c96d23a8ea932b5bb92ec58a9ecdccf8d92ba9f3ef39
7
+ data.tar.gz: 871e97599a8adbdf2041af5bd96ea04b24f637b0f7c8a92c47392f437b0095c5d9a4c1668f270eba16134e18e9dbad83b6cb576e5e3ce5fd60bd4981e75258c5
data/lib/to_proc/all.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  require 'to_proc'
2
2
 
3
- Object.include ToProc[:[]]
4
- Class.include ToProc[:new]
5
- require 'to_proc/Array'
3
+ require 'to_proc/sugar'
6
4
 
7
5
  require 'to_proc/try'
File without changes
@@ -0,0 +1 @@
1
+ Class.include ToProc[:new]
@@ -0,0 +1 @@
1
+ Object.include ToProc[:[]]
@@ -0,0 +1,5 @@
1
+ module ToProc
2
+ Link = -> method do
3
+ -> receiver, argument { receiver.send method, argument }
4
+ end
5
+ end
data/lib/to_proc/sugar.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'to_proc'
2
2
 
3
- Object.include ToProc[:[]]
4
- Class.include ToProc[:new]
3
+ require 'to_proc/core/Object'
4
+ require 'to_proc/core/Class'
5
+ require 'to_proc/core/Array'
6
+
data/lib/to_proc/try.rb CHANGED
@@ -1,10 +1,12 @@
1
- Try = -> process do
2
- -> input do
3
- begin
4
- output = process[input]
5
- output.nil? ? input : output
6
- rescue
7
- input
1
+ module ToProc
2
+ Try = -> process do
3
+ -> input do
4
+ begin
5
+ output = process[input]
6
+ output.nil? ? input : output
7
+ rescue
8
+ input
9
+ end
8
10
  end
9
11
  end
10
12
  end
data/lib/to_proc.rb CHANGED
@@ -1,7 +1,9 @@
1
- ToProc = -> name do
2
- Module.new do
3
- define_method :to_proc do
4
- method(name).to_proc
1
+ module ToProc
2
+ def self.[] name
3
+ Module.new do
4
+ define_method :to_proc do
5
+ method(name).to_proc
6
+ end
5
7
  end
6
8
  end
7
9
  end
data/to_proc.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |g|
2
2
  g.name = 'to_proc'
3
3
  g.files = `git ls-files`.split($/)
4
- g.version = '0.0.2'
4
+ g.version = '0.0.3'
5
5
  g.summary = 'What if almost any object were a proc?'
6
6
  g.authors = ['Anatoly Chernow']
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow
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-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -17,8 +17,11 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/to_proc.rb
20
- - lib/to_proc/Array.rb
21
20
  - lib/to_proc/all.rb
21
+ - lib/to_proc/core/Array.rb
22
+ - lib/to_proc/core/Class.rb
23
+ - lib/to_proc/core/Object.rb
24
+ - lib/to_proc/link.rb
22
25
  - lib/to_proc/sugar.rb
23
26
  - lib/to_proc/try.rb
24
27
  - to_proc.gemspec