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

Avoid already defined constant warnings in Ruby 1.8.

In Ruby 1.8 it happens that MemberTag is loaded twice and the
constants in it get redefined, and trigger a warning.
parent 8228fbc6
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -45,12 +45,15 @@ module JsDuck::Tag
    #
    attr_reader :member_type

    # Avoid already-defined-constant warnings in Ruby 1.8
    unless defined?(MEMBER_POS_CFG)
      MEMBER_POS_CFG = 1
      MEMBER_POS_PROPERTY = 2
      MEMBER_POS_METHOD = 3
      MEMBER_POS_EVENT = 4
      MEMBER_POS_CSS_VAR = 5
      MEMBER_POS_CSS_MIXIN = 6
    end

    # Extracts the fields auto-detected from code that are relevant to
    # the member type and returns a hash with them.