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.
15 16 17 18 19 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 15 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
10 11 12 13 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 10 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)
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 27 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 |
#param_content ⇒ Object
21 22 23 |
# File 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb', line 21 def param_content param_contents end |