hellobase-core_ext 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: e191e592e337ef8b810f1e0b7e24bc9cb446267f6ff7a307487ca48a283feef3
4
+ data.tar.gz: 7671567f7c29ae2c503f430a7cbe9cab33a8232d45fb3e8e4163a4593ab0271f
5
+ SHA512:
6
+ metadata.gz: 1c5fa4f34ae46a953c320e86581194f9d72a8b33f9adbe12e9061086ce0a536965f593a9eaa6609ccb78ed83d6aff317d9e0b7d80eef5fdfb980a46a3ba53f14
7
+ data.tar.gz: 58b7253183aabcb60251e35c18ef24acf044453a91b3f54aed445ea914c51bdd99005710c42701a977c078486e26fdb1d61b0985587137c4f62161b934df2f7e
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2020 AENEA LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ module Hellobase
2
+ module CoreExt
3
+ module DivideByZeroFix
4
+ def /(arg)
5
+ begin
6
+ result = super
7
+ result == BigDecimal::INFINITY || result == -BigDecimal::INFINITY ? BigDecimal::NAN : result
8
+ rescue ZeroDivisionError
9
+ BigDecimal::NAN
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ ::Integer.prepend ::Hellobase::CoreExt::DivideByZeroFix
17
+ ::BigDecimal.prepend ::Hellobase::CoreExt::DivideByZeroFix
@@ -0,0 +1,5 @@
1
+ module Hellobase
2
+ module CoreExt
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'bigdecimal'
2
+
3
+ require 'hellobase/core_ext/divide_by_zero_fix'
4
+
5
+ module Hellobase
6
+ end
data/lib/hellobase.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'hellobase/core_ext'
2
+
3
+ module Hellobase
4
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hellobase-core_ext
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anthony Wang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.14'
27
+ description:
28
+ email:
29
+ - awang@hellobase.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - lib/hellobase.rb
36
+ - lib/hellobase/core_ext.rb
37
+ - lib/hellobase/core_ext/divide_by_zero_fix.rb
38
+ - lib/hellobase/core_ext/version.rb
39
+ homepage: https://github.com/K0D1A/hellobase-core_ext
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubygems_version: 3.2.32
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Core extensions for Hellobase
62
+ test_files: []