Sha256: a83bcc2422a57b4f818282095da275a5a8266e71793a6d256e1207f0f4082601

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

module YARD
  module Server
    module Commands
      # Returns a list of objects of a specific type
      class ListCommand < LibraryCommand
        include Templates::Helpers::BaseHelper
        
        def items; raise NotImplementedError end
        def type; raise NotImplementedError end

        def run
          options.update(:items => items, :template => :doc_server, 
                         :list_type => request.path.split('/').last, :type => :full_list)
          render
        end
      end
      
      # Returns the list of classes / modules in a library
      class ListClassesCommand < ListCommand
        def type; :class end
        
        def items
          Registry.load_all
          run_verifier(Registry.all(:class, :module))
        end
      end
      
      # Returns the list of methods in a library
      class ListMethodsCommand < ListCommand
        include Templates::Helpers::ModuleHelper
        
        def type; :methods end
        
        def items
          Registry.load_all
          items = Registry.all(:method).sort_by {|m| m.name.to_s }
          prune_method_listing(items)
        end
      end
      
      # Returns the list of README/extra files in a library
      class ListFilesCommand < ListCommand
        def type; :files end
        def items; options[:files] end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yard-0.6.8 lib/yard/server/commands/list_command.rb
yard-0.6.7 lib/yard/server/commands/list_command.rb
yard-0.6.6 lib/yard/server/commands/list_command.rb
yard-0.6.5 lib/yard/server/commands/list_command.rb
yard-0.6.4 lib/yard/server/commands/list_command.rb