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

#acceptedObject

Returns the value of attribute accepted

Returns:

  • (Object)

    the current value of accepted



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

def accepted
  @accepted
end

#ambiguousObject

Returns the value of attribute ambiguous

Returns:

  • (Object)

    the current value of ambiguous



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

def ambiguous
  @ambiguous
end

#unmatchedObject

Returns the value of attribute unmatched

Returns:

  • (Object)

    the current value of 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.

Returns:

  • (Boolean)


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

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

#to_hObject



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