Class: Utility::Filtering

Inherits:
Object
  • Object
show all
Defined in:
lib/utility/filtering.rb

Class Method Summary collapse

Class Method Details

.extract_filter(filtering) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/utility/filtering.rb', line 12

def extract_filter(filtering)
  return {} unless filtering.present?

  # assume for now, that first object in filtering array or a filter object itself is the only filtering object
  filter = filtering.is_a?(Array) ? filtering.first : filtering

  filter.present? ? filter : {}
end

.rule_pre_processing_active?(filter) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/utility/filtering.rb', line 21

def rule_pre_processing_active?(filter)
  !filter.dig('advanced_snippet', 'value')&.present?
end