pretty_integers 1.0.0

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 +7 -0
  2. data/lib/pretty_integers.rb +13 -0
  3. metadata +57 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d55973a101b2e90e9cc508868ebe948583e28772a442e5265af309e675b7a599
4
+ data.tar.gz: 7198ac85e12a76f8fbce7e0f39043a16dd5dea022e8f8a8a298b9be9cd890968
5
+ SHA512:
6
+ metadata.gz: 4e6e379a92abc503bfac88a40ce32f30fbfe752bae1060e14375c9eb2badaba5a8a55698b4248f43dba273d897ddedbf7d2eb764e5bc1a58e34739a6c3166105
7
+ data.tar.gz: b8e6ad761968bb2b75bbb036cd684af201194d990a038c620e16b56e24f70f8839ea7d868ebb6daf0c3c9bd6a6023b6eff134838883824681a7c676aae5fcf58
@@ -0,0 +1,13 @@
1
+ class Integer
2
+ # changes numbers like 1234567 to "1,234,567"
3
+ def prettify(separator=',')
4
+ self
5
+ .to_s
6
+ .chars
7
+ .reverse
8
+ .each_slice(3)
9
+ .map{|slice| slice.join }
10
+ .join(separator)
11
+ .reverse
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pretty_integers
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Lunt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: a small utility to format integers for easier reading
28
+ email: jefflunt@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/pretty_integers.rb
34
+ homepage: https://github.com/jefflunt/pretty_integers
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubygems_version: 3.4.1
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: extends the Integer class to add a few methods for inserting places separators
57
+ test_files: []