Hi mariano
what are you doing? because it looks strange to need a sort block
generator :).
Why cann't filter all the objects that have either fields to nil first?
Stef
On 31/7/14 19:40, Mariano Martinez Peck wrote:
Hi guys,
Currently I have some sorting blocks which support "nil" elements
(making them go first).
So here is a general nil tolerant sort block based on one field:
defaultNilTolerantSortBlock: aBlock
[ :a :b |
a
ifNil: [ true ]
ifNotNil: [ b
ifNil: [ false ]
ifNotNil: [
aBlock value: a value: b
] ]
]
Now...imagine that now I want to first on element1, then over
element2...and both could be nil...in which case should go "first".
Anyway...does someone ever built some tool where you pass an ordered
set of closures and it builds the super ugly resulting sort block?
Cheers,
--
Mariano
http://marianopeck.wordpress.com