lib/nice_partials/partial/section.rb in nice_partials-0.9.0 vs lib/nice_partials/partial/section.rb in nice_partials-0.9.1

- old
+ new

@@ -22,27 +22,31 @@ # # <% partial.title "Some title content", class: "xl" %> # Write the content and options to the `title` # <% partial.title.h2 ", appended" %> # => <h2 class="xl">Some title content, appended</h2> # # Note that NicePartials don't support deep merging attributes out of the box. - # For that, bundle https://github.com/seanpdoyle/attributes_and_token_lists def method_missing(meth, *arguments, **keywords, &block) if meth != :p && @view_context.respond_to?(meth) append @view_context.public_send(meth, *arguments, **keywords, &block) else @view_context.tag.public_send(meth, @content + arguments.first.to_s, **options.merge(keywords), &block) end end - def respond_to_missing?(...) = @view_context.respond_to?(...) + def respond_to_missing?(...) + @view_context.respond_to?(...) + end + private def capture(block) if block&.arity&.nonzero? chunks << block else super end end - def chunks() = @chunks ||= [] + def chunks + @chunks ||= [] + end end