fn_syntax 1.0.0 → 1.0.1
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/README.md +5 -3
- data/fn_syntax.gemspec +1 -1
- data/lib/fn_syntax.rb +3 -3
- data/lib/fn_syntax/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: fd287dc0fe094106672de1ab875d7eb14e41816a
|
4
|
+
data.tar.gz: 71fe26d972a3d0df2d75a477fc9896a47b9832d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc76457cc194ba466728ab0053ce6667163897ce1497aad661e1b9069599ddadd2ce219d0c84310811672500424b54026b5d07351e0999f9b5b7d4cc24a9f0cf
|
7
|
+
data.tar.gz: 3788f8944551943d7898a487ece30f3c3a38f01236b73e9ed6c557d53fa60c7ca1cd7f618534c4ad70b871633d1e3690438cc7de8b159c0264aaf2aefb685c67
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# FnSyntax
|
2
2
|
|
3
|
-
|
3
|
+
Adds fn method to define anonymous functions with args available as _1, _2, _3 upto _9
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,11 +18,13 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
require 'fn_syntax'
|
22
|
+
times_four = fn{ _1 * 4 }
|
23
|
+
(1..5).map ×_four
|
22
24
|
|
23
25
|
## Contributing
|
24
26
|
|
25
|
-
1. Fork it ( https://github.com/
|
27
|
+
1. Fork it ( https://github.com/alesguzik/fn_syntax/fork )
|
26
28
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
29
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
30
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/fn_syntax.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["me@aguzik.net"]
|
11
11
|
spec.summary = %q{Lambda shorthand: fn{ _1 * 2 } }
|
12
12
|
spec.description = %q{Adds fn method to define anonymous functions with arguments available as _1, _2, _3 upto _9}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/alesguzik/fn-syntax"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/fn_syntax.rb
CHANGED
@@ -7,7 +7,7 @@ module FnSyntax
|
|
7
7
|
self._args_ = args
|
8
8
|
end
|
9
9
|
|
10
|
-
(1..
|
10
|
+
(1..9).each do |n|
|
11
11
|
define_method "_#{n}" do
|
12
12
|
self._args_[n-1]
|
13
13
|
end
|
@@ -20,8 +20,8 @@ module FnSyntax
|
|
20
20
|
|
21
21
|
module ::Kernel
|
22
22
|
def fn(&block)
|
23
|
-
|
24
|
-
FnObject.new(args).instance_exec &block
|
23
|
+
lambda do |*args|
|
24
|
+
FnObject.new(args).instance_exec *args, &block
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/fn_syntax/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fn_syntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ales Guzik
|
@@ -54,7 +54,7 @@ files:
|
|
54
54
|
- fn_syntax.gemspec
|
55
55
|
- lib/fn_syntax.rb
|
56
56
|
- lib/fn_syntax/version.rb
|
57
|
-
homepage:
|
57
|
+
homepage: https://github.com/alesguzik/fn-syntax
|
58
58
|
licenses:
|
59
59
|
- MIT
|
60
60
|
metadata: {}
|