Files
2026-10-10 14:57:27 +02:00

753 lines
18 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>class Card - RDoc Documentation</title>
<meta
name="keywords"
content="ruby,class,Card"
>
<meta
name="description"
content="class Card: Représente une carte à jouer avec sa valeur et sa couleur."
>
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="class Card - RDoc Documentation">
<meta property="og:description" content="Représente une carte à jouer avec sa valeur et sa couleur.">
<!-- Twitter -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="class Card - RDoc Documentation">
<meta name="twitter:description" content="Représente une carte à jouer avec sa valeur et sa couleur.">
<script type="text/javascript">
var rdoc_rel_prefix = "./";
var index_rel_prefix = "./";
</script>
<script
src="./js/theme-toggle.js?v=7.0.4"
></script>
<script
src="./js/search_navigation.js?v=7.0.4"
defer
></script>
<script
src="./js/search_data.js?v=7.0.4"
defer
></script>
<script
src="./js/search_ranker.js?v=7.0.4"
defer
></script>
<script
src="./js/search_controller.js?v=7.0.4"
defer
></script>
<script
src="./js/c_highlighter.js?v=7.0.4"
defer
></script>
<script
src="./js/aliki.js?v=7.0.4"
defer
></script>
<link
href="./css/rdoc.css?v=7.0.4"
rel="stylesheet"
>
<body role="document" class="class has-toc">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<!-- Chevron (right arrow) - used for expand/collapse -->
<symbol
id="icon-chevron"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polyline points="9 18 15 12 9 6"></polyline>
</symbol>
<!-- File/Document - Pages section -->
<symbol
id="icon-file"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path
d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
></path>
<polyline points="14 2 14 8 20 8"></polyline>
</symbol>
<!-- Layers/Stack - Classes and Modules section -->
<symbol
id="icon-layers"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
<polyline points="2 17 12 22 22 17"></polyline>
<polyline points="2 12 12 17 22 12"></polyline>
</symbol>
<!-- Curly braces with C - Class Methods section -->
<symbol
id="icon-class-methods"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M6 3C3.5 3 2 4.5 2 7v3c0 1.5-1 2-1 2s1 .5 1 2v5c0 2.5 1.5 4 4 4"></path>
<path d="M18 3c2.5 0 4 1.5 4 4v3c0 1.5 1 2 1 2s-1 .5-1 2v5c0 2.5-1.5 4-4 4"></path>
<text
x="12"
y="17"
text-anchor="middle"
font-size="13"
font-weight="bold"
fill="currentColor"
stroke="none"
>
C
</text>
</symbol>
<!-- Curly braces with I - Instance Methods section -->
<symbol
id="icon-instance-methods"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M6 3C3.5 3 2 4.5 2 7v3c0 1.5-1 2-1 2s1 .5 1 2v5c0 2.5 1.5 4 4 4"></path>
<path d="M18 3c2.5 0 4 1.5 4 4v3c0 1.5 1 2 1 2s-1 .5-1 2v5c0 2.5-1.5 4-4 4"></path>
<text
x="12"
y="17"
text-anchor="middle"
font-size="13"
font-weight="bold"
fill="currentColor"
stroke="none"
>
I
</text>
</symbol>
<!-- Double chevrons up - Ancestors section -->
<symbol
id="icon-ancestors"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polyline points="17 11 12 6 7 11"></polyline>
<polyline points="17 18 12 13 7 18"></polyline>
</symbol>
<!-- User with plus - Included Modules section -->
<symbol
id="icon-includes"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
<circle cx="8.5" cy="7" r="4"></circle>
<line
x1="20"
y1="8"
x2="20"
y2="14"
></line>
<line
x1="23"
y1="11"
x2="17"
y2="11"
></line>
</symbol>
<!-- User with check - Extended Modules section -->
<symbol
id="icon-extends"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
<circle cx="8.5" cy="7" r="4"></circle>
<polyline points="17 11 19 13 23 9"></polyline>
</symbol>
<!-- List - Sections section -->
<symbol
id="icon-list"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line
x1="8"
y1="6"
x2="21"
y2="6"
></line>
<line
x1="8"
y1="12"
x2="21"
y2="12"
></line>
<line
x1="8"
y1="18"
x2="21"
y2="18"
></line>
<line
x1="3"
y1="6"
x2="3.01"
y2="6"
></line>
<line
x1="3"
y1="12"
x2="3.01"
y2="12"
></line>
<line
x1="3"
y1="18"
x2="3.01"
y2="18"
></line>
</symbol>
</svg>
<header class="top-navbar">
<a href="./index.html" class="navbar-brand">
RDoc Documentation
</a>
<!-- Desktop search bar -->
<div class="navbar-search navbar-search-desktop" role="search">
<form action="#" method="get" accept-charset="utf-8">
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results-desktop"
type="text" name="search" placeholder="Search (/) for a class, method..."
spellcheck="false" autocomplete="off"
title="Type to search, Up and Down to navigate, Enter to load">
<ul id="search-results-desktop" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="initially-hidden search-results"></ul>
</form>
</div>
<!-- Mobile search icon button -->
<button id="search-toggle" class="navbar-search-mobile" aria-label="Open search" type="button">
<span aria-hidden="true">🔍</span>
</button>
<!-- Theme toggle button -->
<button id="theme-toggle" class="theme-toggle" aria-label="Switch to dark mode" type="button">
<span class="theme-toggle-icon" aria-hidden="true">🌙</span>
</button>
</header>
<!-- Search Modal (Mobile) -->
<div id="search-modal" class="search-modal" hidden aria-modal="true" role="dialog" aria-label="Search">
<div class="search-modal-backdrop"></div>
<div class="search-modal-content">
<div class="search-modal-header">
<form class="search-modal-form" action="#" method="get" accept-charset="utf-8">
<span class="search-modal-icon" aria-hidden="true">🔍</span>
<input id="search-field-mobile" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results-mobile"
type="text" name="search" placeholder="Search documentation"
spellcheck="false" autocomplete="off">
<button type="button" class="search-modal-close" aria-label="Close search" id="search-modal-close">
<span aria-hidden="true">esc</span>
</button>
</form>
</div>
<div class="search-modal-body">
<ul id="search-results-mobile" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="search-results search-modal-results initially-hidden"></ul>
<div class="search-modal-empty">
<p>No recent searches</p>
</div>
</div>
</div>
</div>
<div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
<span aria-hidden="true">&#9776;</span>
</div>
<nav id="navigation" role="navigation" hidden>
<div id="fileindex-section" class="nav-section">
<details class="nav-section-collapsible" >
<summary class="nav-section-header">
<span class="nav-section-icon">
<svg>
<use href="#icon-file"></use>
</svg>
</span>
<span class="nav-section-title">Pages</span>
<span class="nav-section-chevron">
<svg>
<use href="#icon-chevron"></use>
</svg>
</span>
</summary>
<ul class="nav-list">
<li>
<a href="./README_md.html">
README
</a>
</li>
</ul>
</details>
</div>
<div id="parent-class-section" class="nav-section">
<details class="nav-section-collapsible" open>
<summary class="nav-section-header">
<span class="nav-section-icon">
<svg><use href="#icon-ancestors"></use></svg>
</span>
<span class="nav-section-title">Ancestors</span>
<span class="nav-section-chevron">
<svg><use href="#icon-chevron"></use></svg>
</span>
</summary>
<ul><li>Object</li></ul>
</details>
</div>
<div class="nav-section">
<details class="nav-section-collapsible" open>
<summary class="nav-section-header">
<span class="nav-section-icon">
<svg><use href="#icon-class-methods"></use></svg>
</span>
<span class="nav-section-title">Class Methods</span>
<span class="nav-section-chevron">
<svg><use href="#icon-chevron"></use></svg>
</span>
</summary>
<ul class="nav-list" role="directory">
<li ><a href="#method-c-new">new</a></li>
</ul>
</details>
</div>
<div class="nav-section">
<details class="nav-section-collapsible" open>
<summary class="nav-section-header">
<span class="nav-section-icon">
<svg><use href="#icon-instance-methods"></use></svg>
</span>
<span class="nav-section-title">Instance Methods</span>
<span class="nav-section-chevron">
<svg><use href="#icon-chevron"></use></svg>
</span>
</summary>
<ul class="nav-list" role="directory">
<li ><a href="#method-i-strength">strength</a></li>
<li ><a href="#method-i-to_s">to_s</a></li>
</ul>
</details>
</div>
<div id="classindex-section" class="nav-section">
<details class="nav-section-collapsible" open>
<summary class="nav-section-header">
<span class="nav-section-icon">
<svg><use href="#icon-layers"></use></svg>
</span>
<span class="nav-section-title">Classes and Modules</span>
<span class="nav-section-chevron">
<svg><use href="#icon-chevron"></use></svg>
</span>
</summary>
<ul class="link-list nav-list"><li><code><a href="./Card.html">Card</a></code></li><li><code><a href="./Deck.html">Deck</a></code></li><li><code><a href="./Game.html">Game</a></code></li><li><code><a href="./Player.html">Player</a></code></li><li><code><a href="./TerminalUI.html">TerminalUI</a></code></li></ul>
</details>
</div>
</nav>
<main role="main" aria-labelledby="class-Card">
<h1 id="class-Card" class="anchor-link class">
class Card
</h1>
<section class="description">
<p>Représente une carte à jouer avec sa valeur et sa couleur.</p>
</section>
<section id="5Buntitled-5D" class="documentation-section anchor-link">
<section class="attribute-method-details method-section">
<header>
<h3 id="attributes"><a href="#attributes">Attributes</a></h3>
</header>
<div id="attribute-i-suit" class="method-detail anchor-link">
<div class="method-heading attribute-method-heading">
<a href="#attribute-i-suit" title="Link to this attribute">
<span class="method-name">suit</span>
<span class="attribute-access-type">[R]</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="attribute-i-value" class="method-detail anchor-link">
<div class="method-heading attribute-method-heading">
<a href="#attribute-i-value" title="Link to this attribute">
<span class="method-name">value</span>
<span class="attribute-access-type">[R]</span>
</a>
</div>
<div class="method-description">
</div>
</div>
</section>
<section id="public-class-5Buntitled-5D-method-details" class="method-section anchor-link">
<header>
<h3 id="public-class-methods"><a href="#public-class-methods">Public Class Methods</a></h3>
</header>
<div id="method-c-new" class="method-detail anchor-link ">
<div class="method-header">
<div class="method-heading">
<a href="#method-c-new" title="Link to this method">
<span class="method-name">new</span>
<span class="method-args">(value, suit)</span>
</a>
</div>
</div>
<div class="method-controls">
<details class="method-source-toggle">
<summary>Source</summary>
</details>
</div>
<div class="method-source-code" id="new-source">
<pre class="ruby" data-language="ruby"><span class="ruby-comment"># File lib/card.rb, line 5</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">suit</span>)
<span class="ruby-ivar">@value</span> = <span class="ruby-identifier">value</span>
<span class="ruby-ivar">@suit</span> = <span class="ruby-identifier">suit</span>
<span class="ruby-keyword">end</span></pre>
</div>
<div class="method-description">
</div>
</div>
</section>
<section id="public-instance-5Buntitled-5D-method-details" class="method-section anchor-link">
<header>
<h3 id="public-instance-methods"><a href="#public-instance-methods">Public Instance Methods</a></h3>
</header>
<div id="method-i-strength" class="method-detail anchor-link ">
<div class="method-header">
<div class="method-heading">
<a href="#method-i-strength" title="Link to this method">
<span class="method-name">strength</span>
<span class="method-args">()</span>
</a>
</div>
</div>
<div class="method-controls">
<details class="method-source-toggle">
<summary>Source</summary>
</details>
</div>
<div class="method-source-code" id="strength-source">
<pre class="ruby" data-language="ruby"><span class="ruby-comment"># File lib/card.rb, line 16</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strength</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/\A\d+\z/</span>)
<span class="ruby-ivar">@value</span>.<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">else</span>
<span class="ruby-keyword">case</span> <span class="ruby-ivar">@value</span>
<span class="ruby-keyword">when</span> <span class="ruby-string">&#39;ace&#39;</span>
<span class="ruby-value">11</span>
<span class="ruby-keyword">when</span> <span class="ruby-string">&#39;jack&#39;</span>
<span class="ruby-value">12</span>
<span class="ruby-keyword">when</span> <span class="ruby-string">&#39;queen&#39;</span>
<span class="ruby-value">13</span>
<span class="ruby-keyword">when</span> <span class="ruby-string">&#39;king&#39;</span>
<span class="ruby-value">14</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
<div class="method-description">
<p>Retourne la force de la carte sous forme d’integer.</p>
</div>
</div>
<div id="method-i-to_s" class="method-detail anchor-link ">
<div class="method-header">
<div class="method-heading">
<a href="#method-i-to_s" title="Link to this method">
<span class="method-name">to_s</span>
<span class="method-args">()</span>
</a>
</div>
</div>
<div class="method-controls">
<details class="method-source-toggle">
<summary>Source</summary>
</details>
</div>
<div class="method-source-code" id="to_s-source">
<pre class="ruby" data-language="ruby"><span class="ruby-comment"># File lib/card.rb, line 11</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
<span class="ruby-node">&quot;#{@value} of #{@suit}&quot;</span>
<span class="ruby-keyword">end</span></pre>
</div>
<div class="method-description">
<p>Retourne une représentation de la carte sous forme de string.</p>
</div>
</div>
</section>
</section>
</main>
<aside class="table-of-contents" role="complementary" aria-label="Table of Contents">
<div class="toc-sticky">
<h3 class="toc-heading">On This Page</h3>
<nav class="toc-nav" id="toc-nav" aria-label="Page sections">
<!-- Generated by JavaScript based on page headings -->
</nav>
</div>
</aside>
<footer class="site-footer">
<div class="footer-bottom">
<p>
Generated by <a href="https://ruby.github.io/rdoc/">RDoc 7.0.4</a>
using the Aliki theme by <a href="http://st0012.dev">Stan Lo</a>
</p>
</div>
</footer>
</body>