class NicePartials::Partial::Content class Options < Hash def initialize(view_context) @view_context = view_context end def to_s @view_context.tag.attributes(self) end end def initialize(view_context, content = nil) @view_context, @options = view_context, Options.new(view_context) @content = ActiveSupport::SafeBuffer.new and concat content end delegate :to_s, :present?, to: :@content # Contains options passed to a partial: # # <% partial.title class: "post-title" %> # partial.title.options # => { class: "post-title" } # # # Automatically runs `tag.attributes` when `to_s` is called, e.g.: #