Reputation: 11904
For example, if I want to implement a function that does some work A if a block is passed, or work B if there's no block, how do I write the conditional?
obj.func {#some code} #func does work A
obj.func #func does work B
Upvotes: 1
Views: 76
Reputation: 38576
You can use the block_given?
function, if I understood your question correctly.
Upvotes: 6