aozorahack/aozora2html

View on GitHub
lib/aozora2html/tag/decorate.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class Aozora2Html
  class Tag
    # 装飾用
    class Decorate < Aozora2Html::Tag::ReferenceMentioned
      def initialize(parser, target, html_class, html_tag)
        @target = target
        @close = "</#{html_tag}>"
        @open = "<#{html_tag} class=\"#{html_class}\">"
        super
      end

      def to_s
        @open + @target.to_s + @close
      end
    end
  end
end