string_proc 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/string_proc.rb +6 -4
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b29afb2092992a1a24076dd636f00c20239a83eb09ea1f95c87ac63be37ee04a
|
4
|
+
data.tar.gz: f4f8222c5a9b18afe76c161ae004dd435170a68cf3532e4ec549f37e57ef3529
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 985779642be9abf16bf6f724fa6be5029fd02e6c365b5c049ce319e909b12756ff074aefb9b1bf9a7f2632d134b8d4d67b3c3fefa942e5397049a234706b7c11
|
7
|
+
data.tar.gz: 97c8536ee2e6685a76dd939b025d935214307b619eb49f5ff66a014a6fcaf0b525e6bdb05d1e387287d5eb420612b0c916faaf12921f5d411fb8663591cf12dc
|
data/lib/string_proc.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Adds `String#to_proc` to allow multiple method chain calls on each element of an enumerable using the `&` shorthand
|
4
|
+
# The default separator is `.` but can be changed with the `String.proc_separator=` setter
|
3
5
|
class String
|
4
|
-
|
6
|
+
@proc_separator = '.'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
class << self
|
9
|
+
attr_accessor :proc_separator
|
8
10
|
end
|
9
11
|
|
10
12
|
def to_proc
|
11
13
|
proc do |object|
|
12
|
-
split(
|
14
|
+
split(self.class.proc_separator).reduce(object) { |obj, method| obj.send(method) }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Rosenberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Adds `String#to_proc`.
|
14
14
|
email: aarongrosenberg@gmail.com
|
@@ -20,7 +20,8 @@ files:
|
|
20
20
|
homepage: https://github.com/agrberg/string_proc
|
21
21
|
licenses:
|
22
22
|
- MIT
|
23
|
-
metadata:
|
23
|
+
metadata:
|
24
|
+
rubygems_mfa_required: 'true'
|
24
25
|
post_install_message:
|
25
26
|
rdoc_options: []
|
26
27
|
require_paths:
|
@@ -29,14 +30,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
+
version: '2.0'
|
33
34
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
35
|
requirements:
|
35
36
|
- - ">="
|
36
37
|
- !ruby/object:Gem::Version
|
37
38
|
version: '0'
|
38
39
|
requirements: []
|
39
|
-
rubygems_version: 3.
|
40
|
+
rubygems_version: 3.5.17
|
40
41
|
signing_key:
|
41
42
|
specification_version: 4
|
42
43
|
summary: Turn a string into proc of a series of methods to be called on an object.
|