class Gitlab::Triage::Filters::VotesConditionsFilter

Constants

ATTRIBUTES
CONDITIONS

Public Class Methods

filter_parameters() click to toggle source
# File lib/gitlab/triage/filters/votes_conditions_filter.rb, line 10
def self.filter_parameters
  [
    {
      name: :attribute,
      type: String,
      values: ATTRIBUTES
    },
    {
      name: :condition,
      type: String,
      values: CONDITIONS
    },
    {
      name: :threshold,
      type: Numeric
    }
  ]
end

Public Instance Methods

calculate() click to toggle source
# File lib/gitlab/triage/filters/votes_conditions_filter.rb, line 43
def calculate
  case @condition
  when :greater_than
    resource_value > condition_value
  when :less_than
    resource_value < condition_value
  end
end
condition_value() click to toggle source
# File lib/gitlab/triage/filters/votes_conditions_filter.rb, line 39
def condition_value
  @threshold
end
initialize_variables(condition) click to toggle source
# File lib/gitlab/triage/filters/votes_conditions_filter.rb, line 29
def initialize_variables(condition)
  @attribute = condition[:attribute].to_sym
  @condition = condition[:condition].to_sym
  @threshold = condition[:threshold]
end
resource_value() click to toggle source
# File lib/gitlab/triage/filters/votes_conditions_filter.rb, line 35
def resource_value
  @resource[@attribute]
end