Module: WarningShot::Resolver::InstanceMethods Private

Defined in:
lib/warningshot/resolver.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#failedArray<Objects>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

list of failed dependencies

Returns:

  • (Array<Objects>)

    failed dependencies



480
481
482
483
484
# File 'lib/warningshot/resolver.rb', line 480

def failed
  dependencies.inject([]){ |list,dep|
    dep.met ? (list) : (list << dep)
  }
end

#initialize(config, *deps) ⇒ Object

setups up a resolver with config and dependencies

Parameters:

  • config (WarningShot::Config)

    Configuration to use

  • *deps (Array)

    Dependencies from YAML file



524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/warningshot/resolver.rb', line 524

def initialize(config,*deps)
  @config = config
  @dependencies = Set.new
  
  deps.each do |dep|
    # Cast YAML data as described in resolver.
    dep = self.class.yaml_to_object(dep)

    dep.instance_eval { self.class.send(:attr_accessor, :met, :resolved) }
    @dependencies.add dep
  end
end

#passedArray<Objects>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

list of successful dependencies

Returns:

  • (Array<Objects>)


491
492
493
494
495
# File 'lib/warningshot/resolver.rb', line 491

def passed
  dependencies.inject([]){ |list,dep| 
    dep.met ? (list << dep) : (list)
  }
end

#resolve!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loops through dependencies and runs applicable resolutions until one passes



451
452
453
454
455
456
457
458
459
460
# File 'lib/warningshot/resolver.rb', line 451

def resolve!
  dependencies.each do |dep|
    unless dep.met
      self.class.resolutions.each{ |resolution_meta|     
        dep.resolved = process_block :resolution, dep, resolution_meta
        break if dep.resolved
      }
    end
  end
end

#resolvedArray<Objects>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

list of resolved dependencies

Returns:

  • (Array<Objects>)

    resolved dependencies



503
504
505
506
507
# File 'lib/warningshot/resolver.rb', line 503

def resolved        
  dependencies.inject([]){ |list,dep| 
    (!dep.met && dep.resolved) ? (list << dep) : (list)
  }
end

#test!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loops through each dependency and runs applicable tests until one passes



439
440
441
442
443
444
445
446
# File 'lib/warningshot/resolver.rb', line 439

def test!
  dependencies.each do |dep|  
    self.class.tests.each{ |test_meta|  
      dep.met = process_block :test, dep, test_meta
      break if dep.met
    }
  end
end

#unresolvedArray<Objects>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

list of unresolved dependencies

Returns:

  • (Array<Objects>)

    dependencies that weren’t resolved



468
469
470
471
472
# File 'lib/warningshot/resolver.rb', line 468

def unresolved
  dependencies.inject([]){ |list,dep| 
    (!dep.met && !dep.resolved) ? (list << dep) : (list)
  }
end