pinkman 0.9.9.3 → 0.9.9.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
  SHA1:
3
- metadata.gz: eaf850687b7a9d512bc3d4067b8954b0b026512a
4
- data.tar.gz: d5abaa593f063f5c61dd9f0af01bdc6c707e2571
3
+ metadata.gz: 490ed6518a1eb334590e23703403cc7d70dca5bf
4
+ data.tar.gz: 479fcd59581c37a5de0be66945acbe8985d16cea
5
5
  SHA512:
6
- metadata.gz: 0c6d4e69547a913223d81c187056cf6cf0c814135aef3274b4117e8071aeb675f0cc8e95c63502b4ca57388184b8abe7b81a45d1cd610c6234a275e362136643
7
- data.tar.gz: 84b7d8d3d9b9890d7ecac66b188d67f14af534bf46ece67341de12dc785544028fc80e463181b3f5996752242733395056fe13ee9deb0afa132db5de480e8539
6
+ metadata.gz: 93002a215a5099095ace467278bae10b75f8637d913a4c64b805dad390bee90fb2bf5ef54d6c58365134dd2cac69574abb959700a4c3ff544bd5033e2e039fa6
7
+ data.tar.gz: 85c6d4b705417a6fc0f021294541f6ff99dfdd51a25cb1cc1b50a6e4ef7c29d062a030c7643bca1081188a40e4653cb92e5a32bdb79d7b481dcf918c63502256
@@ -377,7 +377,7 @@ class window.PinkmanCollection extends window.PinkmanCommon
377
377
 
378
378
  # Desc: exactly what it suggests
379
379
  shuffle: () ->
380
- if @any?
380
+ if @any()
381
381
  currentIndex = @collection.length
382
382
 
383
383
  # // While there remain elements to shuffle...
@@ -391,6 +391,23 @@ class window.PinkmanCollection extends window.PinkmanCommon
391
391
  @collection[currentIndex] = @collection[randomIndex]
392
392
  @collection[randomIndex] = temporaryValue
393
393
 
394
+ rand: (n) ->
395
+ if @any()
396
+ rand = new @constructor
397
+ currentIndex = Math.min(n,@count())
398
+
399
+ # // While there remain elements to shuffle...
400
+ while (0 != currentIndex)
401
+ # // Pick a remaining element...
402
+ randomIndex = Math.floor(Math.random() * @count())
403
+ currentIndex = currentIndex - 1
404
+ rand.forcePush(@collection[randomIndex])
405
+
406
+ if rand.count() == 1
407
+ return(rand.first())
408
+ else
409
+ return(rand)
410
+
394
411
  # Desc: filters collection whose attribute matches the query
395
412
  filter: (attribute,query,callback) ->
396
413
  if attribute? and query? and query!="" and (typeof(attribute) == "string")
@@ -71,12 +71,15 @@ Pinkman.template_engines =
71
71
  # modifies templates inserting partials before sending them to rendering the engines
72
72
  partialAdapter: (templateBody) ->
73
73
  if templateBody? and templateBody != ''
74
- partialRegex = /{{(?:\s)*partial\((?:\s)*(.*)(?:\s)*\)(?:\s)*}}/gm
74
+ partialRegex = /{{(?:\s)*partial\((?:\s)*((?:\w|-)*)(?:\s)*\)(?:\s)*}}/gm
75
75
  templateBody.replace(partialRegex,@partialInception)
76
76
  else
77
77
  ''
78
78
 
79
79
  partialInception: (match,id) ->
80
+ # partialRegex = /{{(?:\s)*partial\((?:\s)*((?:\w|-)*)(?:\s)*\)(?:\s)*}}/gm
81
+ # id = id.replace(partialRegex,'$1')
82
+ # console.log id
80
83
  p = $("template##{id}.p")
81
84
  if p.length
82
85
  p.html()
@@ -1,3 +1,3 @@
1
1
  module Pinkman
2
- VERSION = "0.9.9.3"
2
+ VERSION = "0.9.9.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinkman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9.3
4
+ version: 0.9.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agilso Oliveira