hut_utils 0.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.
- checksums.yaml +7 -0
- data/lib/hut_utils.rb +20 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 83df612a651e220dfba9d4ef6226c9d1f4de151a35289e67d4efd551913d734d
|
|
4
|
+
data.tar.gz: 7dc15f76f70b6e9d4c02d63215bd729fdb650e978006c5d93c3405d24db54d9d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 911cf2f5518285b3a33208c422545d585a79d551995cbecbfd55d7f36477f6d70cb13848484d65b49ea04f28f24747b32004959a5e81a651b8de30cb64b7b4f9
|
|
7
|
+
data.tar.gz: 842a8efa3400f3ad5e5bd879c99641f7340f8b4a529d8af34a265a07b60ba156dcb89a406d7453be081a8095771e37f3228aafafd820ebae6fcf46c2e69572fd
|
data/lib/hut_utils.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class HutUtils
|
|
2
|
+
def initialize
|
|
3
|
+
append_array_utility_methods
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def append_array_utility_methods
|
|
7
|
+
Array.class_eval do
|
|
8
|
+
def to_hashed_occur
|
|
9
|
+
raise TypeError, "Expected an Object of class Array instead received an Object of class #{self.class}}" unless self.class == Array
|
|
10
|
+
array = self
|
|
11
|
+
result_occur_hash = Hash.new 0
|
|
12
|
+
array.each do |element|
|
|
13
|
+
result_occur_hash.key? element ? result_occur_hash[element] += 1 : result_occur_hash[element] = 1
|
|
14
|
+
end
|
|
15
|
+
result_occur_hash
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
HutUtils.new
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: hut_utils
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Huthaifa Azmi Taya
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-11-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple library that holds different utility methods and adds to default
|
|
14
|
+
class like Array some useful methods
|
|
15
|
+
email: huthaifazmi@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/hut_utils.rb
|
|
21
|
+
homepage: https://rubygems.org/gems/hut_utils
|
|
22
|
+
licenses: []
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubygems_version: 3.3.25
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: This gem provides a set of utility functions for arrays strings and integers
|
|
43
|
+
test_files: []
|