File: C:/Ruby27-x64/share/doc/ruby/html/Bundler/Molinillo/SpecificationProvider.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>module Bundler::Molinillo::SpecificationProvider - RDoc Documentation</title>
<script type="text/javascript">
var rdoc_rel_prefix = "../../";
var index_rel_prefix = "../../";
</script>
<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>
<link href="../../css/fonts.css" rel="stylesheet">
<link href="../../css/rdoc.css" rel="stylesheet">
<body id="top" role="document" class="module">
<nav role="navigation">
<div id="project-navigation">
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
<h2>
<a href="../../index.html" rel="home">Home</a>
</h2>
<div id="table-of-contents-navigation">
<a href="../../table_of_contents.html#pages">Pages</a>
<a href="../../table_of_contents.html#classes">Classes</a>
<a href="../../table_of_contents.html#methods">Methods</a>
</div>
</div>
<div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<div id="search-field-wrapper">
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results"
type="text" name="search" placeholder="Search" spellcheck="false"
title="Type to search, Up and Down to navigate, Enter to load">
</div>
<ul id="search-results" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="initially-hidden"></ul>
</form>
</div>
</div>
<div id="class-metadata">
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
<h3>Methods</h3>
<ul class="link-list" role="directory">
<li ><a href="#method-i-allow_missing-3F">#allow_missing?</a>
<li ><a href="#method-i-dependencies_for">#dependencies_for</a>
<li ><a href="#method-i-name_for">#name_for</a>
<li ><a href="#method-i-name_for_explicit_dependency_source">#name_for_explicit_dependency_source</a>
<li ><a href="#method-i-name_for_locking_dependency_source">#name_for_locking_dependency_source</a>
<li ><a href="#method-i-requirement_satisfied_by-3F">#requirement_satisfied_by?</a>
<li ><a href="#method-i-search_for">#search_for</a>
<li ><a href="#method-i-sort_dependencies">#sort_dependencies</a>
</ul>
</div>
</div>
</nav>
<main role="main" aria-labelledby="module-Bundler::Molinillo::SpecificationProvider">
<h1 id="module-Bundler::Molinillo::SpecificationProvider" class="module">
module Bundler::Molinillo::SpecificationProvider
</h1>
<section class="description">
<p>Provides information about specifcations and dependencies to the resolver, allowing the {Resolver} class to remain generic while still providing power and flexibility.</p>
<p>This module contains the methods that users of <a href="../Molinillo.html"><code>Bundler::Molinillo</code></a> must to implement, using knowledge of their own model classes.</p>
</section>
<section id="5Buntitled-5D" class="documentation-section">
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
<header>
<h3>Public Instance Methods</h3>
</header>
<div id="method-i-allow_missing-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">allow_missing?</span><span
class="method-args">(dependency)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Returns whether this dependency, which has no possible matching specifications, can safely be ignored.</p>
<p>@param [Object] dependency @return [Boolean] whether this dependency can safely be skipped.</p>
<div class="method-source-code" id="allow_missing-3F-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 97</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">allow_missing?</span>(<span class="ruby-identifier">dependency</span>)
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-dependencies_for" class="method-detail ">
<div class="method-heading">
<span class="method-name">dependencies_for</span><span
class="method-args">(specification)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Returns the dependencies of `specification`. @note This method should be 'pure', i.e. the return value should depend</p>
<pre>only on the `specification` parameter.</pre>
<p>@param [Object] specification @return [Array<Object>] the dependencies that are required by the given</p>
<pre>`specification`.</pre>
<div class="method-source-code" id="dependencies_for-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">dependencies_for</span>(<span class="ruby-identifier">specification</span>)
[]
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-name_for" class="method-detail ">
<div class="method-heading">
<span class="method-name">name_for</span><span
class="method-args">(dependency)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Returns the name for the given `dependency`. @note This method should be 'pure', i.e. the return value should depend</p>
<pre>only on the `dependency` parameter.</pre>
<p>@param [Object] dependency @return [String] the name for the given `dependency`.</p>
<div class="method-source-code" id="name_for-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 54</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name_for</span>(<span class="ruby-identifier">dependency</span>)
<span class="ruby-identifier">dependency</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-name_for_explicit_dependency_source" class="method-detail ">
<div class="method-heading">
<span class="method-name">name_for_explicit_dependency_source</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>@return [String] the name of the source of explicit dependencies, i.e.</p>
<pre>those passed to {Resolver#resolve} directly.</pre>
<div class="method-source-code" id="name_for_explicit_dependency_source-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name_for_explicit_dependency_source</span>
<span class="ruby-string">'user-specified dependency'</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-name_for_locking_dependency_source" class="method-detail ">
<div class="method-heading">
<span class="method-name">name_for_locking_dependency_source</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>@return [String] the name of the source of 'locked' dependencies, i.e.</p>
<pre>those passed to {Resolver#resolve} directly as the `base`</pre>
<div class="method-source-code" id="name_for_locking_dependency_source-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name_for_locking_dependency_source</span>
<span class="ruby-string">'Lockfile'</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-requirement_satisfied_by-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">requirement_satisfied_by?</span><span
class="method-args">(requirement, activated, spec)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Determines whether the given `requirement` is satisfied by the given `spec`, in the context of the current `activated` dependency graph.</p>
<p>@param [Object] requirement @param [DependencyGraph] activated the current dependency graph in the</p>
<pre>resolution process.</pre>
<p>@param [Object] spec @return [Boolean] whether `requirement` is satisfied by `spec` in the</p>
<pre>context of the current `activated` dependency graph.</pre>
<div class="method-source-code" id="requirement_satisfied_by-3F-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 44</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">requirement_satisfied_by?</span>(<span class="ruby-identifier">requirement</span>, <span class="ruby-identifier">activated</span>, <span class="ruby-identifier">spec</span>)
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-search_for" class="method-detail ">
<div class="method-heading">
<span class="method-name">search_for</span><span
class="method-args">(dependency)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Search for the specifications that match the given dependency. The specifications in the returned array will be considered in reverse order, so the latest version ought to be last. @note This method should be 'pure', i.e. the return value should depend</p>
<pre>only on the `dependency` parameter.</pre>
<p>@param [Object] dependency @return [Array<Object>] the specifications that satisfy the given</p>
<pre>`dependency`.</pre>
<div class="method-source-code" id="search_for-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">search_for</span>(<span class="ruby-identifier">dependency</span>)
[]
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-sort_dependencies" class="method-detail ">
<div class="method-heading">
<span class="method-name">sort_dependencies</span><span
class="method-args">(dependencies, activated, conflicts)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Sort dependencies so that the ones that are easiest to resolve are first. Easiest to resolve is (usually) defined by:</p>
<pre>1) Is this dependency already activated?
2) How relaxed are the requirements?
3) Are there any conflicts for this dependency?
4) How many possibilities are there to satisfy this dependency?</pre>
<p>@param [Array<Object>] dependencies @param [DependencyGraph] activated the current dependency graph in the</p>
<pre>resolution process.</pre>
<p>@param [{String => <a href="../../Array.html"><code>Array</code></a><Conflict>}] conflicts @return [Array<Object>] a sorted copy of `dependencies`.</p>
<div class="method-source-code" id="sort_dependencies-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sort_dependencies</span>(<span class="ruby-identifier">dependencies</span>, <span class="ruby-identifier">activated</span>, <span class="ruby-identifier">conflicts</span>)
<span class="ruby-identifier">dependencies</span>.<span class="ruby-identifier">sort_by</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dependency</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name_for</span>(<span class="ruby-identifier">dependency</span>)
[
<span class="ruby-identifier">activated</span>.<span class="ruby-identifier">vertex_named</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">payload</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>,
<span class="ruby-identifier">conflicts</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>,
]
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</section>
</section>
</main>
<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>