Sha256: 87ff4bdeff644379e492611fdb888305a5e72fb7fa871ddd4f6a5eeeffa0c027

Contents?: true

Size: 695 Bytes

Versions: 13

Compression:

Stored size: 695 Bytes

Contents

module JsDuck
  module Web

    # Creates an array of small hashes documenting name, parent class
    # and icon of a class.
    class Icons
      def create(classes)
        classes.map do |cls|
          {
            :name => cls[:name],
            :extends => cls[:extends],
            :private => cls[:private],
            :icon => Web::Icons::class_icon(cls),
          }
        end
      end

      # Returns CSS class name for an icon of class
      def self.class_icon(cls)
        if cls[:singleton]
          "icon-singleton"
        elsif cls.inherits_from?("Ext.Component")
          "icon-component"
        else
          "icon-class"
        end
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jsduck-5.3.4 lib/jsduck/web/icons.rb
jsduck-5.3.3 lib/jsduck/web/icons.rb
jsduck-5.3.2 lib/jsduck/web/icons.rb
jsduck-5.3.1 lib/jsduck/web/icons.rb
jsduck-5.3.0 lib/jsduck/web/icons.rb
jsduck-5.2.0 lib/jsduck/web/icons.rb
jsduck-5.1.0 lib/jsduck/web/icons.rb
jsduck-5.0.1 lib/jsduck/web/icons.rb
jsduck-5.0.0 lib/jsduck/web/icons.rb
jsduck-5.0.0.beta5 lib/jsduck/web/icons.rb
jsduck-5.0.0.beta4 lib/jsduck/web/icons.rb
jsduck-5.0.0.beta3 lib/jsduck/web/icons.rb
jsduck-5.0.0.beta2 lib/jsduck/web/icons.rb