[question] The purpose of replacing methods with html(block_name)
Hi @fran-worley !
I wonder what was the reason of introducing html_blocks instead of using methods. Blocks are flexible for sure, but if you want to override a block, you have to either copy/paste the whole block from superclass and add additional logic, or use rename_html_context , e.g:
rename_html_context(:input_column, :default_input_column)
html(:input_column) do |input|
concat 'blah'
concat input.to_html(context: :default_input_column)
end
In my opinion, both of these methods above arent such convenient as using simply:
# class A
def input_column
end
# class B
def input_column
concat 'blah'
super
end
Perhaps I'm missing something? So far, when I'm dealing with input_column or input_label, most cases cover prepending or appending some content into that blocks, because Bootstrap builder is well prepared :+1: .
That is why you'll see that I use a mixture of both html_blocks and instance methods on a element.
I introduced html_blocks to try to decouple HTML rendering from an element itself. This I stand by agree that it lacks the ability to call super. I.e if you define an element with the same context again you can still access it via super. I can than change rename_html_context to just alias_html :old_name, :new_name