apply 1.0.1 → 1.0.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
  SHA1:
3
- metadata.gz: c02a5d7ddd0e72146fab4b3754990b2f46c3e113
4
- data.tar.gz: 714c004f6ee8b600c3c702c8d27bf7e782f91835
3
+ metadata.gz: a867fc3c245f700fd6af6b14d3b10ba1771134f9
4
+ data.tar.gz: 4549f1cd24fb22b068640650e807f073c38ed3c0
5
5
  SHA512:
6
- metadata.gz: a775d7aba153b1c5afa286eb73b2b889f56dbaffce60326d90da81938d4ef8e32f3d7fe1dd1f0c0ed3e8b099f42e0740acc2edd6eac23ae89ab7829a59836d3b
7
- data.tar.gz: d117293c44268e99a04395a7452c49812ca22ff7dc286e9d7f98e0ac69f2fd829214df8746d40f4d4078ab797802cafcd12685d20bd407454491d091302f4d04
6
+ metadata.gz: 341cc4bb04771c5e001ddfd557e1b7bec3b3af8a9cdbad1efa24a5d083a152d46193ee8736df2ea530b6479b9f9426067e8d8fe5e96eb48ea86eb4ef809e9978
7
+ data.tar.gz: afdf4b37468264e14b061723d4c1de79e220939fe63bcc329b693b0d74bbd1342ad26634026acf68b43775861126670beb3c035291f6b0782852a0674fcd0b0b
data/README.md CHANGED
@@ -13,14 +13,12 @@ passed to the proc. If the condition is false, the argument is returned immediat
13
13
  require "apply"
14
14
 
15
15
  # Upcase strings that start with a lowercase letter
16
- upcaser = Apply(&:upcase).if { |value| value =~ /^[a-z]/ }
17
-
18
- %w{ Alice bob Carol }.map(&upcaser) # => [ "Alice", "BOB", "Carol" ]
16
+ upcase_if_starts_with_lowercase = Apply(&:upcase).if { |value| value =~ /^[a-z]/ }
17
+ %w{ Alice bob Carol }.map(&upcase_if_starts_with_lowercase) # => [ "Alice", "BOB", "Carol" ]
19
18
 
20
19
  # Parenthesize non-nil values
21
- parenthesizer = Apply { |text| "(#{text})" }.unless(&:nil?)
22
-
23
- [ "Alice", nil, "Carol" ].map(&parenthesizer) # => [ "(Alice)", nil, "(Bob)" ]
20
+ parenthesize_unless_nil = Apply { |text| "(#{text})" }.unless(&:nil?)
21
+ [ "Alice", nil, "Carol" ].map(&parenthesize_unless_nil) # => [ "(Alice)", nil, "(Bob)" ]
24
22
 
25
23
  ```
26
24
 
@@ -2,11 +2,11 @@ require "apply/version"
2
2
 
3
3
  module Apply
4
4
  def if(&test)
5
- self.class.new(&(->(value) { test[value] ? call(value) : value }))
5
+ ->(value) { test[value] ? call(value) : value }
6
6
  end
7
7
 
8
8
  def unless(&test)
9
- self.class.new(&(->(value) { test[value] ? value : call(value) }))
9
+ ->(value) { test[value] ? value : call(value) }
10
10
  end
11
11
  end
12
12
 
@@ -1,3 +1,3 @@
1
1
  module Apply
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apply
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Carney