fe_core_ext 0.6.0 → 0.7.0

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: 4f06e084d44efa2d19f7efada870d33bcd135d3c
4
- data.tar.gz: 853f4e1aa04376d9982a66a0da5aab8d6fbe28ce
3
+ metadata.gz: 19d199f9b1e53d03ea27d4344623d2fef4a1a51f
4
+ data.tar.gz: dee7a8d26ee853586c6068756d902fc3cd725ae2
5
5
  SHA512:
6
- metadata.gz: ee20ad08ea9b7f9074473257445ad2f8fe7e480079aaaaf7dcee52fd6434d3fb894ebe7fc238a18d117399431ad5153af7ba4a5105d31dba21669ae21d4e45d9
7
- data.tar.gz: 50780771ae9384b797403d882453e35a69918a875c61fe4d39d5e981a858d911178202cf71c61d583b1ba4fdb65ed00c08e3d79e906e74b9a605dbe9f4b0f6fd
6
+ metadata.gz: 675d1ccf81930636f29bc9f63c63b877f4ef49e9c2f9017932c06f9db97abeed537adcca65519e6ceca9e4b34a467f5b21a2d0b33a5f884d527bcffdb5f158f4
7
+ data.tar.gz: 0bdace3a4dcf40d91078c431fd14e9e9ab886b474fee498b4b8d863579d0c7e31ee4720f55cd28ec8730a784e424b66917bccb2d25bc34f6a3dcd0166caa7336
@@ -16,6 +16,33 @@ module FeCoreExt::CoreExt::Array
16
16
  return if empty?
17
17
  sum.to_d / size
18
18
  end
19
+
20
+ # remove, remove_at, remove_if はこちらのものを使わせてもらっています。
21
+ # https://gist.github.com/nekoTheShadow/2de8a324f445bdde8a67
22
+ def remove(val)
23
+ # ブロックが渡されており、かつvalと等しい要素が見つからなかった場合
24
+ return yield if block_given? && !self.include?(val)
25
+
26
+ temp = self.dup
27
+ temp.delete(val)
28
+ temp
29
+ end
30
+
31
+ def remove_at(pos)
32
+ temp = self.dup
33
+ temp.delete_at(pos)
34
+ temp
35
+ end
36
+
37
+ def remove_if
38
+ temp = self.dup
39
+ # ブロックを持たない場合
40
+ return temp.delete_if unless block_given?
41
+
42
+ self.each{|val| temp.delete(val) if yield(val)}
43
+ temp
44
+ end
45
+
19
46
  end
20
47
 
21
48
  class Array
@@ -1,3 +1,3 @@
1
1
  module FeCoreExt
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fe_core_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-08 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport