Why can private helper methods still be accessed in views?

前端 未结 1 552
难免孤独
难免孤独 2021-02-19 02:57

Just another \"why is it that way\" question: I noticed that private helper methods still can be accessed within views. Why\'s that? And is there a way to prevent this (e.g. whe

1条回答
  •  庸人自扰
    2021-02-19 03:20

    Helpers are modules that get mixed in to the views. This means that public, protected and private methods in the helper become public, protected and private methods on the views.

    I don't think that you can actually hide the helper methods from the view. You'd need to do something like have a helper class which you instantiate in the helper and then delegate calls to that - sounds like it could get messy fast though. :)

    0 讨论(0)
提交回复
热议问题