xls_function 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78fe15af8eb4b5dafce02e10b89a8328b1e025d035e1349982faceebfe40aa43
4
- data.tar.gz: 52223d13a8aae89a0998e08b349299d63968c178192c549d7b03ff7a8347cf91
3
+ metadata.gz: 19795c0020e6176ec325435eb1e451edf5dae9e8c9a4c155e86d8fe56e49c061
4
+ data.tar.gz: a4d9775f07d72cd19d6b9cc3e666b298e38ee9becb0e0bb5289b828486e882fb
5
5
  SHA512:
6
- metadata.gz: 1b05087ff9d7379fd8b4608f304162f8a1d69b623e5ced9b9e93f62b521c4b8fc5cfe91f526554e2c57416da7c626b5b76ecb90652a20b0d6af712fae4339f1a
7
- data.tar.gz: 2a304ec0fcd97fc916833ea8be32f37fcd873e937638c68cc27527222c114842bb0a71b09bf2bbd3747b4c6c8a1cd92062ffec94089ce687007ac6a8dc72daf3
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
 
@@ -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.
@@ -64,4 +64,5 @@ ja:
64
64
  cannot_convert_to_number: "%{source}は数値に変換できません。"
65
65
  cannot_convert_to_date: "%{source}は日付に変換できません。"
66
66
  cannot_convert_to_time: "%{source}は時刻に変換できません。"
67
+ cannot_divide_by_zero: "0除算が発生しました。"
67
68
  invalid_value_for_function: 値が数式または関数に対して無効です。
@@ -1,3 +1,3 @@
1
1
  module XlsFunction
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
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.3
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: 2022-12-23 00:00:00.000000000 Z
11
+ date: 2023-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n