Class: Inch::API::Suggest

Inherits:
Filter
  • Object
show all
Defined in:
lib/inch/api/suggest.rb

Instance Attribute Summary

Attributes inherited from Filter

#codebase, #grade_lists

Instance Method Summary collapse

Constructor Details

#initialize(codebase, options) ⇒ Suggest

Returns a new instance of Suggest



6
7
8
9
# File 'lib/inch/api/suggest.rb', line 6

def initialize(codebase, options)
  super
  @options = Options::Suggest.new(options)
end

Instance Method Details

#all_objectsArray

Returns all the objects that match @options

Returns:

  • (Array)

    all the objects that match @options



23
24
25
# File 'lib/inch/api/suggest.rb', line 23

def all_objects
  relevant_objects
end

#filesObject



11
12
13
14
15
# File 'lib/inch/api/suggest.rb', line 11

def files
  list = files_sorted_by_importance
  how_many = @options.file_count || list.size
  list[0...how_many]
end

#objectsArray

Returns the @options.object_count objects the API suggests

Returns:

  • (Array)

    the @options.object_count objects the API suggests



18
19
20
# File 'lib/inch/api/suggest.rb', line 18

def objects
  filter_objects_to_display
end