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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ce2a000ec98e0c031f99b3e4922342b4641fe41
4
- data.tar.gz: d4baef7200daca43c2ee175137c77fb3af259ba5
3
+ metadata.gz: fd287dc0fe094106672de1ab875d7eb14e41816a
4
+ data.tar.gz: 71fe26d972a3d0df2d75a477fc9896a47b9832d1
5
5
  SHA512:
6
- metadata.gz: d8067b858d3d6055fe208fcc273dec637692b14c1b434b9c81c20d550b15788d1347f9a2cac21f1a9f9bbc1c7157e200b1547a2d882e59ee73cd229ab4a09bf8
7
- data.tar.gz: bb85f6728fc69b3e9c5385898719ef3c349ec512bbab6bbc920076937d2f7d988850370259f75124f5aed1fbdfcdee86b953cf608ce314071451f93bd2ae141e
6
+ metadata.gz: bc76457cc194ba466728ab0053ce6667163897ce1497aad661e1b9069599ddadd2ce219d0c84310811672500424b54026b5d07351e0999f9b5b7d4cc24a9f0cf
7
+ data.tar.gz: 3788f8944551943d7898a487ece30f3c3a38f01236b73e9ed6c557d53fa60c7ca1cd7f618534c4ad70b871633d1e3690438cc7de8b159c0264aaf2aefb685c67
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # FnSyntax
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
21
+ require 'fn_syntax'
22
+ times_four = fn{ _1 * 4 }
23
+ (1..5).map &times_four
22
24
 
23
25
  ## Contributing
24
26
 
25
- 1. Fork it ( https://github.com/[my-github-username]/fn_syntax/fork )
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).each do |n|
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
- proc do |*args|
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
@@ -1,3 +1,3 @@
1
1
  module FnSyntax
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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: {}