Class: Hiccdown::Renderable
- Inherits:
-
Object
- Object
- Hiccdown::Renderable
- Defined in:
- lib/hiccdown/railtie.rb
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(helper_module, action_name) ⇒ Renderable
constructor
A new instance of Renderable.
-
#render_in(view_context) ⇒ Object
This is the view-bound view_context.
Constructor Details
#initialize(helper_module, action_name) ⇒ Renderable
Returns a new instance of Renderable.
16 17 18 19 |
# File 'lib/hiccdown/railtie.rb', line 16 def initialize(helper_module, action_name) @helper_module = helper_module @action_name = action_name end |
Instance Method Details
#format ⇒ Object
29 30 31 |
# File 'lib/hiccdown/railtie.rb', line 29 def format :html end |
#render_in(view_context) ⇒ Object
This is the view-bound view_context. Needed for ‘content_for` to work properly in helper, see stackoverflow.com/a/78783866/1371131
23 24 25 26 27 |
# File 'lib/hiccdown/railtie.rb', line 23 def render_in(view_context) content = @helper_module.instance_method(@action_name).bind_call(view_context) Hiccdown::to_html(content) end |