Hiccdown Development Notes
Notes about developing the Ruby gem Hiccdown.
Log in or sign up to participate in this discussion.
With an account, you can revise, criticize, and comment on ideas, and submit new ideas.Hiccdown methods should live in their own, separate classes. How about they are called ‘displays’?
class ProductsDisplaydef index vc, # …vc.some_helper_methodendend
Behind the scenes, the Hiccdown gem would need to make the instance variables available to the display class:
display = @display_module.newview_context.instance_variables.each do |iv|display.instance_variable_set(iv,view_context.instance_variable_get(iv))end
Then:
class ProductsDisplaydef index vc, # …vc.some_helper_method(@products)endend
Then how would you call index from a helper method?
I don’t think that’s something people would do a lot, but they still easily could: ProductsRenderer.index(self)
Tested, it works. self does indeed point to the view_context in the helper. Verified by printing object_ids.
It doesn’t really matter. This would be like calling a controller action from a helper method. Not something people do.
I’m trying this now. Having to prepend every invocation of a helper method with vc. is getting really old really fast.