Class: Necropsy::FlowResult

Inherits:
Data
  • Object
show all
Defined in:
lib/necropsy/models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(receiver_facts: {}, value_facts: {}, return_fact: ValueFact.unknown(:no_direct_return), issues: [], steps: 0) ⇒ FlowResult

Returns a new instance of FlowResult.



770
771
772
773
774
775
776
# File 'lib/necropsy/models.rb', line 770

def initialize(receiver_facts: {}, value_facts: {}, return_fact: ValueFact.unknown(:no_direct_return), issues: [], steps: 0)
  receiver_facts = receiver_facts.dup.compare_by_identity.freeze
  value_facts = value_facts.dup.compare_by_identity.freeze
  issues = Array(issues).map(&:to_s).uniq.sort.freeze
  steps = Integer(steps)
  super
end

Instance Attribute Details

#issuesObject (readonly)

Returns the value of attribute issues

Returns:

  • (Object)

    the current value of issues



769
770
771
# File 'lib/necropsy/models.rb', line 769

def issues
  @issues
end

#receiver_factsObject (readonly)

Returns the value of attribute receiver_facts

Returns:

  • (Object)

    the current value of receiver_facts



769
770
771
# File 'lib/necropsy/models.rb', line 769

def receiver_facts
  @receiver_facts
end

#return_factObject (readonly)

Returns the value of attribute return_fact

Returns:

  • (Object)

    the current value of return_fact



769
770
771
# File 'lib/necropsy/models.rb', line 769

def return_fact
  @return_fact
end

#stepsObject (readonly)

Returns the value of attribute steps

Returns:

  • (Object)

    the current value of steps



769
770
771
# File 'lib/necropsy/models.rb', line 769

def steps
  @steps
end

#value_factsObject (readonly)

Returns the value of attribute value_facts

Returns:

  • (Object)

    the current value of value_facts



769
770
771
# File 'lib/necropsy/models.rb', line 769

def value_facts
  @value_facts
end

Instance Method Details

#fact_for(node) ⇒ Object



778
779
780
# File 'lib/necropsy/models.rb', line 778

def fact_for(node)
  value_facts[node] || receiver_facts[node]
end

#to_hObject



782
783
784
785
786
787
788
789
790
# File 'lib/necropsy/models.rb', line 782

def to_h
  {
    'receiver_facts' => receiver_facts.values.map(&:to_h),
    'value_fact_count' => value_facts.length,
    'return_fact' => return_fact.to_h,
    'issues' => issues,
    'steps' => steps
  }
end