Class: Gitlab::Triage::GraphqlQueries::QueryParamBuilders::DateParamBuilder

Inherits:
BaseParamBuilder
  • Object
show all
Defined in:
lib/gitlab/triage/graphql_queries/query_param_builders/date_param_builder.rb

Constant Summary collapse

ATTRIBUTES =
%w[updated_at created_at merged_at].freeze

Instance Attribute Summary

Attributes inherited from BaseParamBuilder

#negated, #param_contents, #param_name, #with_quotes

Instance Method Summary collapse

Methods inherited from BaseParamBuilder

#build_param

Constructor Details

#initialize(condition_hash) ⇒ DateParamBuilder

Returns a new instance of DateParamBuilder.



13
14
15
16
17
# File 'lib/gitlab/triage/graphql_queries/query_param_builders/date_param_builder.rb', line 13

def initialize(condition_hash)
  date_param_builder = ParamBuilders::DateParamBuilder.new(ATTRIBUTES, condition_hash)

  super(build_param_name(condition_hash), date_param_builder.param_content)
end

Instance Method Details

#build_param_name(condition_hash) ⇒ Object (private)



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gitlab/triage/graphql_queries/query_param_builders/date_param_builder.rb', line 21

def build_param_name(condition_hash)
  prefix = condition_hash[:attribute].to_s.delete_suffix('_at')
  suffix =
    case condition_hash[:condition].to_sym
    when :older_than
      'Before'
    when :newer_than
      'After'
    end

  "#{prefix}#{suffix}"
end