material_raingular 0.1.5.5 → 0.1.5.6

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: 43ff00bee31d5d8c0c99201e826343163ecb65c3
4
- data.tar.gz: 0d41f86c9803a1310f7b55b1861b7c8dbb9d7d2a
3
+ metadata.gz: 59a9545f417c657e7d89f1e04b11709a3881d24d
4
+ data.tar.gz: aa2000cc97a512d745269f2df766d433bc5ac715
5
5
  SHA512:
6
- metadata.gz: e7def9087ac7369583f2f25cc994d2a3cb17a4fe99819542eac30de8154ee37f8c7753ea9fd8e64a8e4737debe1a9c7500b006eb8b34b7878933050e09719c67
7
- data.tar.gz: ae6e7071e6d2bdbe869aa59e8bed1134156409590c0ef032eb502c68e4d0263b4ef6375dfbabcdf488864c15d16e1c7e040148845e1565917b4da3dd1e3da1b6
6
+ metadata.gz: d867df5b880ad63b2d84edfe952c9657a66ee39a59eb6d6038d702ea05c8f6cf8fd9367e4935e48071ba847a0ad79f2e47e3b67a169673bc533708e6b722e9cc
7
+ data.tar.gz: ad5d51e3f4b6f83da301c08fb0d50622060b14c758c2f7b82a0b62f4a694b0fd140a2638bc3da60375e3cebecf8f2ce9d921ac97eaac4e8e536578f271a0f949
@@ -45,8 +45,12 @@ Array.prototype.sum = ->
45
45
  Array.prototype.includes = (entry)->
46
46
  this.indexOf(entry) > -1
47
47
  Array.prototype.drop = (entry)->
48
- return this unless this.indexOf(entry) > -1
49
- this.splice(this.indexOf(entry),1)
48
+ if entry.hasOwnProperty('id')
49
+ index = @.pluck('id').indexOf(entry.id)
50
+ else
51
+ index = @.indexOf(entry)
52
+ return this unless index > -1
53
+ @.splice(index,1)
50
54
  String.prototype.titleize = ->
51
55
  return this.replace(/\_/g,' ').replace(/([A-Z])/g, ' $1').trim().replace(/\b[a-z]/g, (letter)->
52
56
  return letter[0].toUpperCase())
@@ -90,3 +94,19 @@ Array.prototype.where = (obj) ->
90
94
  addEntry = addEntry && equiv(entry[key], value)
91
95
  result.push(entry) if addEntry
92
96
  result
97
+ Array.prototype.intersection = (arr) ->
98
+ res = []
99
+ for val in @
100
+ res.push(val) if arr.includes(val)
101
+ return res
102
+ Array.prototype.intersects = (arr) ->
103
+ @.intersection(arr).length > 0
104
+ Array.prototype.find = (id) ->
105
+ index = @.pluck('id').indexOf(id)
106
+ @[index]
107
+ Array.prototype.index = (obj) ->
108
+ return unless obj.hasOwnProperty('id')
109
+ @.pluck('id').indexOf(obj.id)
110
+ Array.prototype.update = (obj) ->
111
+ return unless obj.hasOwnProperty('id')
112
+ @[@.index(obj)] = obj
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.1.5.5"
2
+ VERSION = "0.1.5.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_raingular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.5
4
+ version: 0.1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2016-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler