Sha256: 55d49d4edd52ad428bbaaec28dea1fdd7c8a7c7571b5ae2c019be0df2b7c72b5

Contents?: true

Size: 755 Bytes

Versions: 11

Compression:

Stored size: 755 Bytes

Contents

module YARD
  module Templates::Helpers
    module UMLHelper
      def uml_visibility(object)
        case object.visibility
        when :public;    '+'
        when :protected; '#'
        when :private;   '-'
        end
      end
      
      def format_path(object)
        object.path.gsub('::', '_')
      end
      
      def h(text)
        text.to_s.gsub(/(\W)/, '\\\\\1')
      end
      
      def tidy(data)
        indent = 0
        data.split(/\n/).map do |line|
          line.gsub!(/^\s*/, '')
          next if line.empty?
          indent -= 1 if line =~ /^\s*\}\s*$/
          line = (' ' * (indent * 2)) + line
          indent += 1 if line =~ /\{\s*$/
          line
        end.compact.join("\n") + "\n"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
yard-0.5.8 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.7 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.6 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.5 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.4 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.3 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.2 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.1p1 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.1 lib/yard/templates/helpers/uml_helper.rb
yard-0.5.0 lib/yard/templates/helpers/uml_helper.rb
yard-0.4.0 lib/yard/templates/helpers/uml_helper.rb