kaki-utils 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: d44a23d9124c3edf3b8ccc3de112cdf23db70a56
4
- data.tar.gz: f0d28dc4ea72f7ad823c7a659f7ca597497729bc
3
+ metadata.gz: 2b390abccdce27a6d7204ff963f6493f81dff5bd
4
+ data.tar.gz: 6e7b9cc43eaaca7f7d9a3a968b754523d5d55260
5
5
  SHA512:
6
- metadata.gz: bda104aa5d9236c72ba0b0d203f57b8ef637c39cb3539a376313adb3ee2b07923abf31f493657abdf0b12ba12ceace68104b21e518bca19b5c5547924a33a26e
7
- data.tar.gz: d1da3dd3b2862ee545316e26d2c9b3aee1e368c1700264f0a0355b6dd7be1de020b6eca000fcccf8f3da70dd50b44f753e28293f2b35de875e69da4c45274466
6
+ metadata.gz: 2bf2fea2203b58f324602841db235e1ab3d4a0f43534c6c8f5c6f09818a78233830865dd491a212545db2fbce01dc0569591a1e066357cc77645f3d72ace0f68
7
+ data.tar.gz: 9c9db246be6cc8be080464b220215b7f18b34ae7822c9046c5809a9811cd7de6bf5f04bb27a7160573ae5b41a0d75d71591242e95138b2b8e28d17a21308511a
data/README.md CHANGED
@@ -13,6 +13,7 @@ methods
13
13
  * Utils.delete\_non\_img(file_name)
14
14
  * Utils.delete\_empty\_folder(folder_name = './')
15
15
  * Utils.bell    (only Ubuntu)
16
+ * Utils.factorial(n)
16
17
 
17
18
  ## Recurring decimal
18
19
 
@@ -60,4 +61,4 @@ require "kaki/utils/nest_loop"
60
61
  ```
61
62
  method
62
63
 
63
- * Enumerable#nest\_loop
64
+ * Array#nest\_loop
@@ -1,4 +1,4 @@
1
- module Enumerable
1
+ module Array
2
2
  #任意の階層だけ繰り返しを行い、ブロックの返り値を順に配列に入れて返す。ブロックが与えられていなければ Enumerator を返す。
3
3
  # @return [Array]
4
4
  def nest_loop
@@ -1,5 +1,5 @@
1
1
  class Integer
2
- #例外ならば n 回リトライする
2
+ #例外ならばブロックを n 回リトライする
3
3
  def times_retry(message: true, wait: 0)
4
4
  n = 1
5
5
  begin
data/lib/kaki/utils.rb CHANGED
@@ -93,4 +93,14 @@ module Utils
93
93
  `paplay /usr/share/sounds/freedesktop/stereo/complete.oga`
94
94
  end
95
95
  module_function :bell
96
+
97
+
98
+ #階乗
99
+ # @return [Integer]
100
+ def factorial(n)
101
+ result = 1
102
+ 2.upto(n) {|i| result *= i}
103
+ result
104
+ end
105
+ module_function :factorial
96
106
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaki-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - obelisk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-07 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk2