Sha256: 7711d8a7e58dc522fd6617a1c6f14598eea1482b67ca020a42bb75a956424614

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

module BottleRocket
  module ContentTags

    class ContentTag
      attr_reader :tag_type, :attributes

      def initialize(tag_type, attributes={})
        @tag_type   = tag_type
        @attributes = attributes
      end

      def to_s(&block)
        "<#{tag_type} #{html_attributes}>" + (block_given? ? yield : '') + "</#{tag_type}>"
      end

      def html_attributes
        attributes.map {|k, v| "#{k}=\"#{v}\"" }.join(' ')
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bottle_rocket-0.0.1 lib/bottle_rocket/content_tag.rb