Class: ActionView::MissingTemplate::Results
Do not use. This class is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | actionview/lib/action_view/template/error.rb |
Class Method Summary
- .new(size) ⇒ Results constructor
Instance Method Summary
Constructor Details
.new(size) ⇒ Results
# File 'actionview/lib/action_view/template/error.rb', line 63
def initialize(size) @size = size @results = [] end
Instance Method Details
#add(path, score)
[ GitHub ]# File 'actionview/lib/action_view/template/error.rb', line 80
def add(path, score) if should_record?(score) @results << Result.new(path, score) @results.sort_by!(&:score) @results.pop if @results.size > @size end end
#should_record?(score) ⇒ Boolean
# File 'actionview/lib/action_view/template/error.rb', line 72
def should_record?(score) if @results.size < @size true else score < @results.last.score end end
#to_a
[ GitHub ]# File 'actionview/lib/action_view/template/error.rb', line 68
def to_a @results.map(&:path) end