kink 1.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/kink.rb +30 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8ce17ce5a791615597617539691ad59579119fc0aa2377a9cf8c6728218d0384
4
+ data.tar.gz: 23d2c13295e1260fd47afd832bb255726ada29c1e754bb785ad22309a3d56284
5
+ SHA512:
6
+ metadata.gz: de5ec75e3b349884bd84226390ac9be9cd5691aafd74aa8746332f4864cee3ddf8437d559bb677317b9bc1b197c896146ddb8922004cec592734fb9009249006
7
+ data.tar.gz: 1b58d0f383a84f7d9e4e813f2db3ea6c0f9bbbff1e5268e919a7fe1b28f565b47502f7eec54193abbea94801a847ef66b485376ee2c22b840dfdcceb6ef960f7
data/lib/kink.rb ADDED
@@ -0,0 +1,30 @@
1
+ module Kink
2
+ class NextArgs < Array
3
+ end
4
+
5
+ module_function
6
+
7
+ def kink_next(*args)
8
+ NextArgs.[](*args)
9
+ end
10
+
11
+ def kink(*y)
12
+ unless block_given?
13
+ return enum_for(:kink) { 1 }
14
+ end
15
+
16
+ begin
17
+ v = y
18
+ while true
19
+ v = yield(*v)
20
+ break v unless v.is_a? NextArgs
21
+ next unless v.length > 0
22
+ h,*t = v
23
+ next h unless v.length > 1
24
+ next h,*t
25
+ end
26
+ rescue StopIteration => e
27
+ e.result
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kink
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Aaron Paterson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: kink provides a unified syntax to mix and match for, while, do while,
14
+ and until semantics all day long in a way that still feels familiar to the loop
15
+ connoisseur.
16
+ email: 9441877+MayCXC@users.noreply.github.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/kink.rb
22
+ homepage: https://github.com/MayCXC/Kink
23
+ licenses:
24
+ - MIT
25
+ metadata:
26
+ source_code_uri: https://github.com/MayCXC/Kink
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '2.6'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.0.3.1
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: kink is an alternative loop.
46
+ test_files: []