invokable 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: 4908901ef4becc2a2de44b1ce8a23d656ac5f2a5b00b3122b59d087fdc30e7c7
4
- data.tar.gz: a042c77682ff40a6d481d14cb20840113eac45757b21c13ec0e2e40f52abdad5
3
+ metadata.gz: faf0947e19adf5c11f17f5893122d24aa48323807dd364593a38c391e8901c34
4
+ data.tar.gz: a482d9ddd514251f362c149eca16774b5b4853159eb52c79653c3f5f8df5b9ac
5
5
  SHA512:
6
- metadata.gz: 9e320d788d71a963d844f262a56a3c9413a016b89f050a9249d17e5cd57157d39588410f190f0b85b682c91b11c183597955a72ea508cea0460dcf1f033adf86
7
- data.tar.gz: f7b08dcbf9311e95791c98df269e2533ace49abc7aba539c767aa4755db60e3d81754f4e65574094ede2f01c621167cd5270b135ea5329b36810441cf49e7dfb
6
+ metadata.gz: 7d2b9ac66665785662b3ab016981a4c747ab32c88e637cb2bfc2a52e34ed353e5f341a5ef178582e7a3cae584576c341aa88907967cd4722acd07c2cb29d001e
7
+ data.tar.gz: a89620c1f7127ed27794ef84d45803cbabaf93ceee680edf80a638f4c020551fbde83b3682d8afef70597a692158b157c701d9f3c27b634e5e24476c37f81337
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ gemspec
7
7
 
8
8
  group :development do
9
9
  gem 'pry'
10
+ gem 'yard'
10
11
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- invokable (0.2.1)
4
+ invokable (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -26,6 +26,7 @@ GEM
26
26
  diff-lcs (>= 1.2.0, < 2.0)
27
27
  rspec-support (~> 3.9.0)
28
28
  rspec-support (3.9.2)
29
+ yard (0.9.24)
29
30
 
30
31
  PLATFORMS
31
32
  ruby
@@ -36,6 +37,7 @@ DEPENDENCIES
36
37
  pry
37
38
  rake (~> 10.0)
38
39
  rspec (~> 3.0)
40
+ yard
39
41
 
40
42
  BUNDLED WITH
41
43
  1.17.3
data/README.md CHANGED
@@ -62,7 +62,7 @@ many one method objects out there (e.g. ServiceObjects) that are essentially fun
62
62
 
63
63
  # API
64
64
 
65
- ## to_proc -> a_proc
65
+ ## `to_proc -> Proc`
66
66
 
67
67
  ```ruby
68
68
  hash = { a: 1, b, 2 }
@@ -76,8 +76,7 @@ returning a proc that passes it's arguments to the object's `call` method. When
76
76
  loaded `Hash#call` is mapped to `Hash#dig`, `Array#call` is mapped to `Array#at`, and `Set#call`
77
77
  is mapped to `Set#include?`.
78
78
 
79
- ## curry -> a_proc
80
- ## curry(arity) -> a_proc
79
+ ## `curry([arity]) -> Proc`
81
80
 
82
81
  Returns a curried proc. If the `arity` is given, it determines the number of arguments.
83
82
  (see [Proc#curry](https://ruby-doc.org/core-2.7.0/Proc.html#method-i-curry)).
data/lib/invokable.rb CHANGED
@@ -4,7 +4,7 @@ require 'invokable/version'
4
4
  module Invokable
5
5
  # If object responds to `call` convert into a Proc forwards it's arguments along to `call`.
6
6
  #
7
- # @see [Proc#call]
7
+ # @see https://ruby-doc.org/core-2.7.0/Proc.html#method-i-call Proc#call
8
8
  # @return [Proc]
9
9
  def to_proc
10
10
  if respond_to?(:call)
@@ -17,14 +17,15 @@ module Invokable
17
17
  end
18
18
  end
19
19
 
20
- # Return a curried proc. If the optional arity argument is given, it determines the number of arguments.
20
+ # Return a curried proc. If the optional `arity` argument is given, it determines the number of arguments.
21
21
  # A curried proc receives some arguments. If a sufficient number of arguments are supplied, it passes the
22
22
  # supplied arguments to the original proc and returns the result. Otherwise, returns another curried proc
23
23
  # that takes the rest of arguments.
24
24
  #
25
- # @see [Proc#curry]
25
+ # @see https://ruby-doc.org/core-2.7.0/Proc.html#method-i-curry Proc#curry
26
+ # @param arity [Number]
26
27
  # @return [Proc]
27
- def curry(*args)
28
- to_proc.curry(*args)
28
+ def curry(arity = nil)
29
+ to_proc.curry(arity)
29
30
  end
30
31
  end
@@ -1,6 +1,10 @@
1
1
  require_relative '../invokable'
2
2
 
3
+ # Extend core Array object by aliasing it's `[]` method as `call`,
4
+ # and including the `Invokable` module.
5
+ #
6
+ # @see https://ruby-doc.org/core-2.7.0/Array.html#method-i-5B-5D Array#[]
3
7
  class Array
4
8
  include Invokable
5
- alias call at
9
+ alias call []
6
10
  end
@@ -1,5 +1,9 @@
1
1
  require_relative '../invokable'
2
2
 
3
+ # Extend core Hash object by aliasing it's `dig` method as `call`,
4
+ # and including the `Invokable` module.
5
+ #
6
+ # @see https://ruby-doc.org/core-2.7.0/Hash.html#method-i-dig Hash#dig
3
7
  class Hash
4
8
  include Invokable
5
9
  alias call dig
data/lib/invokable/set.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'set'
2
2
  require_relative '../invokable'
3
3
 
4
+ # Extend stdlib Set object by aliasing it's `include?` method as `call`,
5
+ # and including the `Invokable` module.
6
+ #
7
+ # @see https://ruby-doc.org/stdlib-2.7.0/libdoc/set/rdoc/Set.html#method-i-include-3F Set#include?
4
8
  class Set
5
9
  include Invokable
6
10
  alias call include?
@@ -1,3 +1,3 @@
1
1
  module Invokable
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invokable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delon Newman