pinkman 0.9.9.3 → 0.9.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 490ed6518a1eb334590e23703403cc7d70dca5bf
|
4
|
+
data.tar.gz: 479fcd59581c37a5de0be66945acbe8985d16cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)*(
|
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()
|
data/lib/pinkman/version.rb
CHANGED