shivabhusal / lacerate

Opensource Ruby App to scrape Google search results and generate reports
https://shivabhusal.github.io/lacerate/
1 stars 1 forks source link

Usage of Null Objects in views can be avoided using presenter classes #20

Open olivierobert opened 7 years ago

olivierobert commented 7 years ago

A lot of erb-based views + controllers / would benefit of using presenter classes to abstract the complexity of rendering content.

Instead of:

 result: @result[:url] || ResultNullObject.new

It could be (abbreviated example):

result: @result_presenter.url
class ResultPresenter
   ...
   def url
      @result[:url] || ResultNullObject.new
   end
end
shivabhusal commented 7 years ago

Indeed, should have used presenter; but thought it would be an overkill for such a small project. :)