This is a stylistic nit pick, but typically methods that end in “?”
return true or false rather than some other value. I would personally
name the methods “user_browser_version” or “user_platform” or
something like that.
Thanks for your feedback,
I have made the changes to remove the ‘?’ based on your comments.
Cheers,
Scott S.
Jeremy McAnally wrote:
This is a stylistic nit pick, but typically methods that end in “?”
return true or false rather than some other value. I would personally
name the methods “user_browser_version” or “user_platform” or
something like that.
What? Replace methods? No way. Just add some nice convenience methods to
pretty up the views.
For example:
def running_osx?
which_platform == ‘Mac’
end
def running_windows
which_platform == “Windows”
end
Etc. You’re not replacing methods… you are adding a DSL to your
plugin…
which makes views much easier.
It also allows you to change the underlying implementation. For
example…
which_platform might return “Windows” right now… but what if it
returns
win32 in some cases? It might also return something else in the future.
This is one reason why you access your params in a Rails application via
params (a method) and not @params (an instance variable)