[question] Best Practices?
mikegee opened this issue · 4 comments
mikegee commented
I installed this gem and started casting objects to nil, but I haven't recouped my initial investment yet. I'm concerned about using the gem improperly. Could you share some pointers, pro tips, and/or life hacks to improve my to_nil usage?
carlosbaraza commented
The possibilities are endless. Any usage of this gem is a ruby master best practice. Just as an usage example:
begin
raise StandardError.to_nil
rescue Exception => e
puts 'owned'
end
jomo commented
You can also use this in rails applications, for example:
# Register nil Mime Type
Mime::Type.register "nil/nil", :nil
respond_to do |format|
format.xml { render xml: @person.to_xml }
format.nil { render text: @person.to_nil }
end
mikegee commented
Given The Billion Dollar Mistake, this gem is probably worth about tree fiddy. I ported my apps to Haskell and deleted Ruby. Thanks anyway.
carlosbaraza commented
Hahaha you guys made my day.