comparable-reverse 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9364355482c2f89bc064195d3afeb16bc7359926335d33b1933548c9d7b08d9e
4
+ data.tar.gz: cc22488ecc6d6ba9f00e584d85f301976d8ca0b14603104e7ac6530d770b6633
5
+ SHA512:
6
+ metadata.gz: a2b57e64dc39efedbe106a1de2646115cb533191b6b012f5ecd8934119fb009c915a2268876c098b7a2a4d37e4076355e400f7d9c52e12b9461d640946d94b90
7
+ data.tar.gz: 18fb45629656a6af6b7ad4899289b65e085bfb0d3a899e5395b1820b9e065c8af9800e245b608ea37ecea7a807c9f4233b2b4b0cc288573b749d7bdba0e42db4
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ require:
2
+ - rubocop-minitest
3
+ - rubocop-rake
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.3
7
+ NewCops: enable
8
+
9
+ Layout/SpaceInsideHashLiteralBraces:
10
+ EnforcedStyle: no_space
11
+
12
+ Lint/AmbiguousOperatorPrecedence:
13
+ Enabled: false
14
+
15
+ Metrics/ParameterLists:
16
+ Max: 9
17
+
18
+ Style/Alias:
19
+ EnforcedStyle: prefer_alias
20
+
21
+ Style/Documentation:
22
+ Enabled: false
23
+
24
+ Style/NumberedParametersLimit:
25
+ Max: 9
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Shannon Skipper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Comparable::Reverse
2
+
3
+ This tiny gem allows you to reverse `sort_by` order.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ gem install comparable-reverse
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ruby
14
+ require 'comparable/reverse'
15
+
16
+ [1, 3, 2].sort_by { |number| Comparable::Reverse[number] }
17
+ #=> [3, 2, 1]
18
+ ```
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Comparable
4
+ Reverse = Data.define :value do
5
+ def <=>(other) = other.value <=> value
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: comparable-reverse
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Shannon Skipper
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2024-06-11 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Reverse sort order of `it` in a block with `Reverse[it]`.
13
+ email:
14
+ - shannonskipper@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ".rubocop.yml"
20
+ - LICENSE.txt
21
+ - README.md
22
+ - lib/comparable/reverse.rb
23
+ homepage: https://github.com/havenwood/comparable-reverse
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ rubygems_mfa_required: 'true'
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: 3.3.0
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.6.0.dev
43
+ specification_version: 4
44
+ summary: Provides a `Reverse` to reverse sort order.
45
+ test_files: []