string_proc 1.0.0 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/string_proc.rb +10 -4
  3. metadata +12 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a6e35d687a58b3a6a2cac243f48d2e21a71aa83e
4
- data.tar.gz: f9f5c8cbcd28464bf57156b01dc076d70fed066c
2
+ SHA256:
3
+ metadata.gz: b29afb2092992a1a24076dd636f00c20239a83eb09ea1f95c87ac63be37ee04a
4
+ data.tar.gz: f4f8222c5a9b18afe76c161ae004dd435170a68cf3532e4ec549f37e57ef3529
5
5
  SHA512:
6
- metadata.gz: b84afd9001e46c3ec7b028cbf85ba3a2c53865fb96f547426b9bab4dfcf93cbe461e0d518e4585dd039449184b05223a1b925bb6659f25bf6a8ece3b80d2c89a
7
- data.tar.gz: d58ffd8f8e7f5d7e16ade2af8e29591edccdafa4794d8c896326a29b0730df2b37297e69a7fb5d06d357c974be1637b0dba7fd559f9cf0b09b55dd6d1f8a510e
6
+ metadata.gz: 985779642be9abf16bf6f724fa6be5029fd02e6c365b5c049ce319e909b12756ff074aefb9b1bf9a7f2632d134b8d4d67b3c3fefa942e5397049a234706b7c11
7
+ data.tar.gz: 97c8536ee2e6685a76dd939b025d935214307b619eb49f5ff66a014a6fcaf0b525e6bdb05d1e387287d5eb420612b0c916faaf12921f5d411fb8663591cf12dc
data/lib/string_proc.rb CHANGED
@@ -1,11 +1,17 @@
1
+ # frozen_string_literal: true
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
1
5
  class String
2
- @@proc_separator ||= '.'
6
+ @proc_separator = '.'
3
7
 
4
- def self.proc_separator=(separator_string)
5
- @@proc_separator = separator_string
8
+ class << self
9
+ attr_accessor :proc_separator
6
10
  end
7
11
 
8
12
  def to_proc
9
- proc {|object| split(@@proc_separator).inject(object) {|obj, cmd| obj.send(cmd) } }
13
+ proc do |object|
14
+ split(self.class.proc_separator).reduce(object) { |obj, method| obj.send(method) }
15
+ end
10
16
  end
11
17
  end
metadata CHANGED
@@ -1,67 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Rosenberg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-03 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rspec
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.0.0
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.0'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.0.0
33
- - !ruby/object:Gem::Dependency
34
- name: simplecov
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.8'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 0.8.0
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '0.8'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.8.0
53
- description: Adds the to_proc method to the string class.
11
+ date: 2024-08-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Adds `String#to_proc`.
54
14
  email: aarongrosenberg@gmail.com
55
15
  executables: []
56
16
  extensions: []
57
17
  extra_rdoc_files: []
58
18
  files:
59
19
  - lib/string_proc.rb
60
- homepage: https://github.com/LtCmdDudefellah/string_proc
20
+ homepage: https://github.com/agrberg/string_proc
61
21
  licenses:
62
22
  - MIT
63
- metadata: {}
64
- post_install_message:
23
+ metadata:
24
+ rubygems_mfa_required: 'true'
25
+ post_install_message:
65
26
  rdoc_options: []
66
27
  require_paths:
67
28
  - lib
@@ -69,16 +30,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
30
  requirements:
70
31
  - - ">="
71
32
  - !ruby/object:Gem::Version
72
- version: '0'
33
+ version: '2.0'
73
34
  required_rubygems_version: !ruby/object:Gem::Requirement
74
35
  requirements:
75
36
  - - ">="
76
37
  - !ruby/object:Gem::Version
77
38
  version: '0'
78
39
  requirements: []
79
- rubyforge_project:
80
- rubygems_version: 2.2.0
81
- signing_key:
40
+ rubygems_version: 3.5.17
41
+ signing_key:
82
42
  specification_version: 4
83
43
  summary: Turn a string into proc of a series of methods to be called on an object.
84
44
  test_files: []