class JsDuck::Tag::Preventable

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.

Public Class Methods

new() click to toggle source
# File lib/jsduck/tag/preventable.rb, line 8
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

Public Instance Methods

parse_doc(p, pos) click to toggle source

@preventable is optionally followed by some method name, but we don't document it.

# File lib/jsduck/tag/preventable.rb, line 19
def parse_doc(p, pos)
  p.match(/.*$/)
  {:tagname => :preventable}
end
process_doc(h, docs, pos) click to toggle source
# File lib/jsduck/tag/preventable.rb, line 24
def process_doc(h, docs, pos)
  h[:preventable] = true
end
to_html(context) click to toggle source
# File lib/jsduck/tag/preventable.rb, line 28
    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