xls_function 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/xls_function/error.rb +6 -0
- data/lib/xls_function/evaluators/binary_operations/divide.rb +9 -0
- data/lib/xls_function/evaluators/functions/ifs.rb +2 -0
- data/lib/xls_function/locales/en.yml +1 -0
- data/lib/xls_function/locales/ja.yml +1 -0
- data/lib/xls_function/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19795c0020e6176ec325435eb1e451edf5dae9e8c9a4c155e86d8fe56e49c061
|
4
|
+
data.tar.gz: a4d9775f07d72cd19d6b9cc3e666b298e38ee9becb0e0bb5289b828486e882fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a15c9d2bb4f02479f3b8794f229a8a1d9399bead0db1ab77970f32e94217ed6fe0de7e6d405dc04091f33199756e279f6e599107526c8bee7a6723536193134e
|
7
|
+
data.tar.gz: 5992e88d6f7bd1b4f7aa56cd7d8dffccf3bec79c79ea7393be2a92e07561f608ef0ab48c39864bec605541d81b8d2844501d5e20c80a9bd4617964b69e299731
|
data/README.md
CHANGED
@@ -38,6 +38,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
38
38
|
|
39
39
|
Bug reports and pull requests are welcome on GitHub at https://github.com/moneyforward/xls_function. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](./CODE_OF_CONDUCT.md).
|
40
40
|
|
41
|
+
- You can create a pull request to the main branch.
|
42
|
+
- You should not change the version on your pull request.
|
41
43
|
|
42
44
|
## License
|
43
45
|
|
data/lib/xls_function/error.rb
CHANGED
@@ -34,12 +34,18 @@ module XlsFunction
|
|
34
34
|
def na(error_info = '')
|
35
35
|
new(ERROR_NA, error_info)
|
36
36
|
end
|
37
|
+
|
38
|
+
# @return #DIV/0!
|
39
|
+
def div0!(error_info = '')
|
40
|
+
new(ERROR_DIV0, error_info)
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
40
45
|
ERROR_VALUE = '#VALUE!'.freeze
|
41
46
|
ERROR_NUM = '#NUM!'.freeze
|
42
47
|
ERROR_NA = '#N/A'.freeze
|
48
|
+
ERROR_DIV0 = '#DIV/0!'.freeze
|
43
49
|
|
44
50
|
ERRORS = [
|
45
51
|
ERROR_VALUE,
|
@@ -5,8 +5,17 @@ module XlsFunction
|
|
5
5
|
operator_as '/'
|
6
6
|
|
7
7
|
def eval
|
8
|
+
return ::XlsFunction::ErrorValue.div0!(divide_by_zero) if right.zero?
|
9
|
+
|
8
10
|
left / right
|
9
11
|
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def divide_by_zero
|
16
|
+
message = error_message(:cannot_divide_by_zero)
|
17
|
+
class_info(message)
|
18
|
+
end
|
10
19
|
end
|
11
20
|
end
|
12
21
|
end
|
@@ -64,4 +64,5 @@ en:
|
|
64
64
|
cannot_convert_to_number: Cannot convert %{source} to number.
|
65
65
|
cannot_convert_to_date: Cannot convert %{source} to date.
|
66
66
|
cannot_convert_to_time: Cannot convert %{source} to time.
|
67
|
+
cannot_divide_by_zero: "Cannot divide by zero."
|
67
68
|
invalid_value_for_function: Invalid value for formula or function.
|
data/lib/xls_function/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xls_function
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nakakuki Shingo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|