Why use Rack-Flash in Sinatra?

Forgive me if this is a question about a noob with an obvious answer, but what's the point of using rack-flash in Sinatra?

It seems that the functionality of the flash-stand can easily be written on its own, and the gem will go a little too far. Is there anything in the rack that I'm missing?

+4
source share
2 answers

README addresses this:

flash[:notice] = "You can stop rolling your own now." 

It seems that the functionality of the flash-stand can easily be written on its own, and the gem will go a little too far. Is there anything in the rack that I'm missing?

Yes:

  • It is distributed like a gem, so you do not need to copy flash implementation on projects. This reuse is key.
  • The interface is compatible with Rails, so the future maintainers of your code will not have to study your individual implementation.
  • It is well tested and developed in the community.
  • You do not waste time creating a small cog.

If your application core functionality does not blink, this small stone of ~ 100 SLOC size that provides the above benefits is hardly crowded.

+3
source

I simply add a message to my session data and run it if there is one. This is what makes flash flash. I looked at it once, and the time I need to find its API is the time when I need to write it again and again. Maybe I missed something, but one of the flash stones crashed about some Sinatra updates and that where the pain begins, if you are dependent on a gem.

0
source

Source: https://habr.com/ru/post/1445905/


All Articles