procify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d5a221ebc444ccfb8641c5e2d383bb998c98dcddcef1cbb8417434b9ec27a70
4
+ data.tar.gz: 84317b8ee8f651b48016ae13c22c0751c2964eb707ffb475bf7d8242e635eb76
5
+ SHA512:
6
+ metadata.gz: 308e0a8a79047d3bf083c15612415a114620183f6e1129e877dbf50983d5cce4b1dec36e86e9166e21f568c0047a188e0f3b8a50074b46443efc5cad0b62c5b0
7
+ data.tar.gz: 3bbb14f921567500d131aa50d66fda463b73eccfd70ed613a7eb57f60a44dadccd19b19449f31b111e1ed1fb62a85191b93d168aa44b9e002be9d6fed7816182
@@ -0,0 +1,22 @@
1
+ class ProcMethodFactory
2
+ def initialize source
3
+ @source = source
4
+ end
5
+
6
+ def method_missing name, *curry
7
+ proc do |*a, **na, &b|
8
+ method = @source.method name
9
+ arity = method.arity
10
+ a = [*curry, *a]
11
+ if arity >= 0
12
+ @source.send(name, *a[...arity], **na, &b)
13
+ else
14
+ @source.send(name, *a, **na, &b)
15
+ end
16
+ end
17
+ end
18
+
19
+ def respond_to? name
20
+ @source.respond_to? name
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Procify
2
+ VERSION = "0.0.1"
3
+ end
data/lib/procify.rb ADDED
@@ -0,0 +1,7 @@
1
+ require_relative 'procify/proc_method_factory'
2
+
3
+ class Object
4
+ def proc &block
5
+ block_given? ? Kernel.proc(&block) : ProcMethodFactory.new(self)
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: procify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Łukasz Pomietło
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: "\n"
14
+ email: oficjalnyadreslukasza@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/procify.rb
20
+ - lib/procify/proc_method_factory.rb
21
+ - lib/procify/version.rb
22
+ homepage: https://github.com/lpogic/procify
23
+ licenses:
24
+ - Zlib
25
+ metadata:
26
+ documentation_uri: https://github.com/lpogic/procify/blob/master/doc/wiki/README.md
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 3.2.2
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.5.6
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Method to proc conversion path
46
+ test_files: []