To replace if and unless within template we introduce the condition keyword. It takes a proc (that take the current object rendered) as argument and a block. The block is parsed at compile time.
The source compiled from the block will be called if the proc is evaluated as true at rendering time. Here's a use example
object :@user
attributes :name
condition(->(u) { u == current_user }) do
attributes :secret
end
To replace
if
andunless
within template we introduce thecondition
keyword. It takes a proc (that take the current object rendered) as argument and a block. The block is parsed at compile time.The source compiled from the block will be called if the proc is evaluated as true at rendering time. Here's a use example