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.



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

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)



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

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

  "#{prefix}#{suffix}"
end