Class: Gitlab::Triage::APIQueryBuilders::DateQueryParamBuilder
- Inherits:
-
BaseQueryParamBuilder
- Object
- BaseQueryParamBuilder
- Gitlab::Triage::APIQueryBuilders::DateQueryParamBuilder
- Defined in:
- lib/gitlab/triage/api_query_builders/date_query_param_builder.rb
Constant Summary collapse
- ATTRIBUTES =
%w[updated_at created_at].freeze
Instance Attribute Summary
Attributes inherited from BaseQueryParamBuilder
#allowed_values, #param_contents, #param_name
Class Method Summary collapse
Instance Method Summary collapse
- #build_param_name(condition_hash) ⇒ Object private
-
#initialize(condition_hash) ⇒ DateQueryParamBuilder
constructor
A new instance of DateQueryParamBuilder.
- #param_content ⇒ Object
Methods inherited from BaseQueryParamBuilder
#build_param, #validate_allowed_values!
Constructor Details
#initialize(condition_hash) ⇒ DateQueryParamBuilder
Returns a new instance of DateQueryParamBuilder.
17 18 19 20 21 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 17 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 |
Class Method Details
.applicable?(condition) ⇒ Boolean
12 13 14 15 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 12 def self.applicable?(condition) ATTRIBUTES.include?(condition[:attribute].to_s) && condition[:filter_in_ruby] != true end |
Instance Method Details
#build_param_name(condition_hash) ⇒ Object (private)
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 29 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 |
#param_content ⇒ Object
23 24 25 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 23 def param_content param_contents end |