lib/cli/mastermind/parent_plan.rb
# Resolves plan name collisions.
#
# If two child plans have the same name, how they're resolved depends on
# what kind of plan they are.  The following situations are convered by
# this method:
#
# 1) Both plans have children.
#   * In this case, the incoming plan's children are merged into the existing
#     plan and the incoming plan is discarded.
#
# 2) One or both plans have no children.
#   * In this case, it's assumed that the childless plans are executable.
#     A warning is printed an the incoming plan replaces the existing plan.
#
# @param key [String] the key the incoming plan will be stored under
# @param plan [Plan] the incoming plan
# @return [Plan] the plan to store
Resolves plan name collisions.
If two child plans have the same name, how they're resolved depends on
what kind of plan they are.  The following situations are convered by
this method.

1) Both plans have children.
In this case, the incoming plan's children are merged into the existing
plan and the incoming plan is discarded.

2) One or both plans have no children.
In this case, it's assumed that the childless plans are executable.
A warning is printed an the incoming plan replaces the existing plan.
Resolves plan name collisions . If two child plans have the same name how they ' re resolved depends on what kind of plan they are . The following situations are convered by this method . 1 ) Both plans have children . In this case the incoming plan ' s children are merged into the existing plan and the incoming plan is discarded . 2 ) One or both plans have no children . In this case it ' s assumed that the childless plans are executable . A warning is printed an the incoming plan replaces the existing plan .
def resolve_conflicts(key, plan)
        return plan unless @children.has_key?(key)
        existing_plan = @children[key]
        if existing_plan.has_children? and plan.has_children?
          existing_plan.add_children plan.children.values
          return existing_plan
        end
        warn <<~PLAN_COLLISON.strip unless defined? RSpec
               Plan name collision encountered when loading plans from "#{plan.filename}" that cannot be merged.
               "#{key}" was previously defined in "#{existing_plan.filename}".
               Plan "#{key}" from "#{plan.filename}" will be used instead.
             PLAN_COLLISON
        plan
      end
def resolve_conflicts ( key , plan ) return plan unless @children . has_key? ( key ) existing_plan = @children [ key ] if existing_plan . has_children? and plan . has_children? existing_plan . add_children plan . children . values return existing_plan end warn <<~PLAN_COLLISON . strip unless defined? RSpec 
               Plan name collision encountered when loading plans from " #{ plan . filename } " that cannot be merged.
               " #{ key } " was previously defined in " #{ existing_plan . filename } ".
               Plan " #{ key } " from " #{ plan . filename } " will be used instead.
              PLAN_COLLISON plan end
Resolves plan name collisions.
Resolves plan name collisions .
# If this namespace isn't taken we're good # Otherwise, we need to handle a name collision # If both plans have children, we merge them together # Otherwise, the plan defined later wins and overwrites the existing plan # Warn the user that this is happening, unless we're running tests.
the plan to store
the plan to store
Plan
key
the key the incoming plan will be stored under
the key the incoming plan will be stored under
plan
the incoming plan
the incoming plan