Class: Ecoportal::API::GraphQL::Diff::Pairing::Engine::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/diff/pairing/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accepted ⇒ Object

Returns the value of attribute accepted



27
28
29
# File 'lib/ecoportal/api/graphql/diff/pairing/engine.rb', line 27

def accepted
  @accepted
end

#ambiguous ⇒ Object

Returns the value of attribute ambiguous



27
28
29
# File 'lib/ecoportal/api/graphql/diff/pairing/engine.rb', line 27

def ambiguous
  @ambiguous
end

#unmatched ⇒ Object

Returns the value of attribute unmatched



27
28
29
# File 'lib/ecoportal/api/graphql/diff/pairing/engine.rb', line 27

def unmatched
  @unmatched
end

Instance Method Details

#resolved? ⇒ Boolean

source field docs with no acceptable target — the pure novelty set.



29
30
31
# File 'lib/ecoportal/api/graphql/diff/pairing/engine.rb', line 29

def resolved?
  ambiguous.empty? && unmatched.empty?
end

#to_h ⇒ Object



33
34
35
36
37
38
39
# File 'lib/ecoportal/api/graphql/diff/pairing/engine.rb', line 33

def to_h
  {
    accepted:  accepted.map(&:to_h),
    ambiguous: ambiguous.map(&:to_h),
    unmatched: unmatched.map { |f| { source_id: f['id'], label: f['label'] } }
  }
end