Module: Canql::Nodes::TestResultGroup::WithCondition

Defined in:
lib/canql/nodes/test_result_group.rb

Instance Method Summary collapse

Instance Method Details

#existence_filterObject



18
19
20
21
22
23
24
# File 'lib/canql/nodes/test_result_group.rb', line 18

def existence_filter
  {
    Canql::EQUALS => ['supplied required', 'supplied'].include?(
      existence_modifier.text_value.strip
    )
  }
end

#requirement_filterObject



26
27
28
29
30
31
32
# File 'lib/canql/nodes/test_result_group.rb', line 26

def requirement_filter
  {
    Canql::EQUALS => ['supplied required', 'missing required'].include?(
      existence_modifier.text_value.strip
    )
  }
end

#test_result_groupObject



7
8
9
# File 'lib/canql/nodes/test_result_group.rb', line 7

def test_result_group
  group.text_value.strip.parameterize.underscore
end

#test_result_group_filterObject



34
35
36
# File 'lib/canql/nodes/test_result_group.rb', line 34

def test_result_group_filter
  { Canql::EQUALS => test_result_group }
end

#to_test_result_groupObject



11
12
13
14
15
16
# File 'lib/canql/nodes/test_result_group.rb', line 11

def to_test_result_group
  test_result_group_hash = { 'exists' => existence_filter }
  test_result_group_hash['required'] = requirement_filter
  test_result_group_hash['group'] = test_result_group_filter if test_result_group.present?
  test_result_group_hash
end