Module | XSD::CodeGen::GenSupport
In: | xsd/codegen/gensupport.rb

### Methods

capitalize format keyword? safeconstname safeconstname? safemethodname safemethodname? safevarname safevarname? uncapitalize

### Public Instance methods

capitalize(target)

[Source]

    # File xsd/codegen/gensupport.rb, line 58
      def capitalize(target)
        target.sub(/^([a-z])/) { $1.tr!('[a-z]', '[A-Z]') }
      end

format(str, indent = nil)

[Source]

    # File xsd/codegen/gensupport.rb, line 119
      def format(str, indent = nil)
        str = trim_eol(str)
        str = trim_indent(str)
        if indent
          str.gsub(/^/, " " * indent)
        else
          str
        end
      end

keyword?(word)

[Source]

    # File xsd/codegen/gensupport.rb, line 114
      def keyword?(word)
        KEYWORD.key?(word)
      end

safeconstname(name)

[Source]

    # File xsd/codegen/gensupport.rb, line 68
      def safeconstname(name)
        safename = name.scan(/[a-zA-Z0-9_]+/).collect { |ele|
          GenSupport.capitalize(ele)
        }.join
        if /^[A-Z]/ !~ safename or keyword?(safename)
          safename = "C_#{safename}"
        end
        safename
      end

safeconstname?(name)

[Source]

    # File xsd/codegen/gensupport.rb, line 79
      def safeconstname?(name)
        /\A[A-Z][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
      end

safemethodname(name)

[Source]

    # File xsd/codegen/gensupport.rb, line 84
      def safemethodname(name)
        safename = name.scan(/[a-zA-Z0-9_]+/).join('_')
        safename = uncapitalize(safename)
        if /^[a-z]/ !~ safename
          safename = "m_#{safename}"
        end
        safename
      end

safemethodname?(name)

[Source]

    # File xsd/codegen/gensupport.rb, line 94
      def safemethodname?(name)
        /\A[a-zA-Z_][a-zA-Z0-9_]*[=!?]?\z/ =~ name
      end

safevarname(name)

[Source]

    # File xsd/codegen/gensupport.rb, line 99
      def safevarname(name)
        safename = uncapitalize(name.scan(/[a-zA-Z0-9_]+/).join('_'))
        if /^[a-z]/ !~ safename or keyword?(safename)
          "v_#{safename}"
        else
          safename
        end
      end

safevarname?(name)

[Source]

    # File xsd/codegen/gensupport.rb, line 109
      def safevarname?(name)
        /\A[a-z_][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
      end

uncapitalize(target)

[Source]

    # File xsd/codegen/gensupport.rb, line 63
      def uncapitalize(target)
        target.sub(/^([A-Z])/) { $1.tr!('[A-Z]', '[a-z]') }
      end

[Validate]