Sha256: bed112be50c2497eeec3c520c0fe40d8fda009c3e4fe5c53a4a6c63ffff0d039

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8
# frozen_string_literal: true

require "hanami/helpers/html_helper"
require "hanami/helpers/escape_helper"

module Brandish
  module Processors
    module HTML
      # A "group."  This is used for grouping together elements for styling,
      # like the "div" element in HTML.  This uses `div` as one of the
      # element names, but that doesn't mean that it includes all of the same
      # attributes.  This accepts the `"class"`, `"id"`, and `"name"` headers.
      #
      # @see Common::Group
      class Group < Common::Group
        include Processor::Block
        include Hanami::Helpers::HtmlHelper
        include Hanami::Helpers::EscapeHelper
        register %i(html group) => self
        self.names = %i(group g div)

        # Creates a div element with the proper class and id values.  This
        # currently ignores the name value.
        #
        # @return [::String]
        def perform
          html.div(raw(accepted_body), class: class_value, id: id_value).to_s
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brandish-0.1.3 lib/brandish/processors/html/group.rb
brandish-0.1.2 lib/brandish/processors/html/group.rb
brandish-0.1.1 lib/brandish/processors/html/group.rb