Sha256: 72fc416dc1cc65b43efba4f4b6e1274594bf71014f1d15c540da24f26eb76875
Contents?: true
Size: 982 Bytes
Versions: 2
Compression:
Stored size: 982 Bytes
Contents
require_relative 'base_limiter' require_relative '../validators/limiter_validator' module Gitlab module Triage module Limiters class DateFieldLimiter < BaseLimiter LIMITS = %i[most_recent oldest].freeze def self.limiter_parameters [ { name: :most_recent, type: Integer }, { name: :oldest, type: Integer } ] end def initialize_variables(limit) @criterion = LIMITS.find(&limit.method(:[])) @threshold = limit[@criterion] end def limit case @criterion when :most_recent @resources.first(@threshold) when :oldest @resources.last(@threshold) end end private def initialize_resources(resources) resources.sort_by { |res| res[:created_at] } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gitlab-triage-0.8.1 | lib/gitlab/triage/limiters/date_field_limiter.rb |
gitlab-triage-0.8.0 | lib/gitlab/triage/limiters/date_field_limiter.rb |