Sha256: 7d502fa59902ab0bb709870103ae78fcd01a7c888a1dcb26986c2187244b230a
Contents?: true
Size: 1.22 KB
Versions: 64
Compression:
Stored size: 1.22 KB
Contents
require_relative 'base_conditions_filter' module Gitlab module Triage module Filters class VotesConditionsFilter < BaseConditionsFilter ATTRIBUTES = %w[upvotes downvotes].freeze CONDITIONS = %w[greater_than less_than].freeze def self.filter_parameters [ { name: :attribute, type: String, values: ATTRIBUTES }, { name: :condition, type: String, values: CONDITIONS }, { name: :threshold, type: Numeric } ] end def initialize_variables(condition) @attribute = condition[:attribute].to_sym @condition = condition[:condition].to_sym @threshold = condition[:threshold] end def resource_value @resource[@attribute] end def condition_value @threshold end def calculate case @condition when :greater_than resource_value > condition_value when :less_than resource_value < condition_value end end end end end end
Version data entries
64 entries across 64 versions & 2 rubygems