partition_by_sign 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/partition_by_sign.rb +13 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: efefa8ea01e8cec2ce16caa818de2c1d2e705c6c512f77d4ae9689cf1e1e713b
4
+ data.tar.gz: 20f533634ca422312ea06a74daef835f39053517eacc800b247df6b0b6173801
5
+ SHA512:
6
+ metadata.gz: e797c0425a90b8e36be834d1c5922b6a320824388bcba8cdc25acade2f0d729a7f21c5f13c28d080950aceeccca8bb744f3f9ae015a83ca1f39f8058a2469e37
7
+ data.tar.gz: 74c4450e14ba43852b8a1b48af3a7e8a4ae889fc42feb17c9a9501e9196cc1058a7e666ab5d3d7f39dccfd9467f7451570df0022e63757a00e45f8264bcafd5a
@@ -0,0 +1,13 @@
1
+ def partition_by_sign(hash)
2
+ negatives, positives = [], []
3
+
4
+ hash.each do |key, value|
5
+ if value.negative?
6
+ negatives << [key, value]
7
+ else
8
+ positives << [key, value]
9
+ end
10
+ end
11
+
12
+ [negatives, positives]
13
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: partition_by_sign
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jaydip Pansuriya
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: pansuriyajaydip21@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/partition_by_sign.rb
20
+ homepage:
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubygems_version: 3.0.3.1
39
+ signing_key:
40
+ specification_version: 4
41
+ summary: 'The gem takes a hash as input and returns two arrays: one containing key-value
42
+ pairs with negative values and the other with positive values.'
43
+ test_files: []