kaki-utils 0.0.4 → 0.0.5

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: 15365e0061e2b715e3b4b10b4afca6afbbb9a53a
4
- data.tar.gz: a4f5df6c961ebf0bc349b9ec96d7d40ac916561b
3
+ metadata.gz: be7bfcdfa5b4d7c65ad38b7f26a419a4047f5d8e
4
+ data.tar.gz: 2640a6c875bd971e56903eb544d6791ee18dba66
5
5
  SHA512:
6
- metadata.gz: 52fbab242215c3ddc75849f2410c03182f3d548c258cea618c77cebf1de3586cf32588a03c83fbf9272e4a1d263f65b72abd77eeda213fae6fab93a955589267
7
- data.tar.gz: cba8d597754852dde3a77590c83dfaf09e14960366d53371d75c534abaeb440edb907055c6d3c1d85c4a5b91ae20b1ef85b4239b0851be23a60b1bd0bf93e2f9
6
+ metadata.gz: a654b1bdcd150825f69ed985d36593a555931837cfcaa94781ba129bff7520b69ac06de45ab20ea584c36d57608dbc0558705e789c7935c19d9cc9bb27d3e242
7
+ data.tar.gz: 9e93f4fbb3d11ae5ae71f61786fca64e99e58db8d287a1ea8167103f516a6559ac31a2540042e5168fb553eaf6778c1bf199214b153a4ce4ab105a57686e2a83
data/README.md CHANGED
@@ -47,9 +47,17 @@ method
47
47
  ## check overlapping of file names
48
48
 
49
49
  ```ruby
50
- require "kaki/utils/check\_fname_overlapping"
50
+ require "kaki/utils/check_fname_overlapping"
51
51
  ```
52
52
  method
53
53
 
54
54
  * File.check\_fname\_overlapping(file_name)
55
55
 
56
+ ## nest loop (like Enumerable#map)
57
+
58
+ ```ruby
59
+ require "kaki/utils/nest_loop"
60
+ ```
61
+ method
62
+
63
+ * Array#nest\_loop
@@ -0,0 +1,25 @@
1
+ class Array
2
+ def nest_loop
3
+ #任意の階層だけ繰り返しを行う
4
+ # @return [Array]
5
+ check = lambda do |obj|
6
+ return 0...obj if obj.class.ancestors.include?(Integer)
7
+ obj
8
+ end
9
+
10
+ result = []
11
+ ns = lambda do |ax, args|
12
+ a, ax = ax.first, ax.drop(1)
13
+ for i in check.call(a)
14
+ nxt = args + [i]
15
+ if ax.empty?
16
+ result << yield(nxt)
17
+ else
18
+ ns.call(ax, nxt)
19
+ end
20
+ end
21
+ end
22
+ ns.call(self, [])
23
+ result
24
+ end
25
+ 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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - obelisk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2018-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk2
@@ -48,6 +48,7 @@ files:
48
48
  - lib/kaki/utils.rb
49
49
  - lib/kaki/utils/check_fname_overlapping.rb
50
50
  - lib/kaki/utils/imgsuffix.rb
51
+ - lib/kaki/utils/nest_loop.rb
51
52
  - lib/kaki/utils/rec_decimal.rb
52
53
  - lib/kaki/utils/retry.rb
53
54
  homepage: