Commit b3d6a432 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Switch @key and @pattern around in BooleanTag.

Let the @key be aut-created from @pattern instead - requirering each
BooleanTag implementation to define @pattern.

This will help with writing Custom Tags tutorial, where I can introduce
the @pattern field first.
parent 972507df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ require "jsduck/tag/boolean_tag"
module JsDuck::Tag
  class Abstract < BooleanTag
    def initialize
      @key = :abstract
      @pattern = "abstract"
      @signature = {:long => "abstract", :short => "ABS"}
      super
    end
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ require "jsduck/tag/boolean_tag"
module JsDuck::Tag
  class Accessor < BooleanTag
    def initialize
      @key = :accessor
      @pattern = "accessor"
      super
    end
  end
+4 −4
Original line number Diff line number Diff line
@@ -2,12 +2,12 @@ require "jsduck/tag/tag"

module JsDuck::Tag
  # Base class for simple boolean @tags.
  # Subclasses should only define @key and call #super,
  # which will take care of setting up @pattern with the same name.
  # Subclasses should only define @pattern and call #super,
  # which will take care of setting up @key with the same name.
  class BooleanTag < Tag
    def initialize
      if @key
        @pattern = @key.to_s
      if @pattern
        @key = @pattern.to_sym
      end
    end

+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ require "jsduck/tag/boolean_tag"
module JsDuck::Tag
  class Chainable < BooleanTag
    def initialize
      @key = :chainable
      @pattern = "chainable"
      @signature = {:long => "chainable", :short => "&gt;"} # show small right-arrow
      super
    end
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ require "jsduck/tag/boolean_tag"
module JsDuck::Tag
  class Evented < BooleanTag
    def initialize
      @key = :evented
      @pattern = "evented"
      super
    end
  end
Loading