Sha256: 3f2cad46554b0b23e7d25e3f951b4437899f6331916cb9cd06a35ea5d0645952

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require "jsduck/tag/tag"

module JsDuck::Tag
  # That's pretty much a boolean tag, but we don't inherit from
  # BooleanTag as unlike other boolean tags it can be followed by some
  # text.
  class Preventable < Tag
    def initialize
      @pattern = "preventable"
      @tagname = :preventable
      @signature = {:long => "preventable", :short => "PREV"}
      @html_position = POS_PREVENTABLE
      # Use the default white box with dark gray border.
      @css = ".preventable-box { text-align: center }"
    end

    # @preventable is optionally followed by some method name, but we
    # don't document it.
    def parse_doc(p)
      p.match(/.*$/)
      {:tagname => :preventable}
    end

    def process_doc(h, docs, pos)
      h[:preventable] = true
    end

    def to_html(context)
      <<-EOHTML
        <div class='rounded-box preventable-box'>
        <p>This action following this event is <b>preventable</b>.
        When any of the listeners returns false, the action is cancelled.</p>
        </div>
      EOHTML
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsduck-5.0.0.beta01 lib/jsduck/tag/preventable.rb