snipt

Ctrl+h for KB shortcuts

Ruby

flight.rb

class Flight
  attr_reader :code, :from, :to, :valid_from, :valid_to, :when_, :duration, :airplane, :distance, :base_price, :crew
  def initialize(code, from, to, valid_from, valid_to, when_, duration, airplane, distance, base_price, crew)
    @code = code
    @from = from
    @to = to
    @valid_from = valid_from
    @valid_to = valid_to
    @when_ = when_
    @duration = duration
    @airplane = airplane
    @distance = distance
    @base_price = base_price
    @crew = crew
  end
end
https://snipt.net/embed/3f004ea3886adc326cfbd283e21e09ae/
/raw/3f004ea3886adc326cfbd283e21e09ae/
3f004ea3886adc326cfbd283e21e09ae
rb
Ruby
16
2019-06-20T15:31:32
True
False
False
/api/public/snipt/2683/
flightrb
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a> <a href="#L-12">12</a> <a href="#L-13">13</a> <a href="#L-14">14</a> <a href="#L-15">15</a> <a href="#L-16">16</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">class</span> <span class="nc">Flight</span> </span><span id="L-2"><a name="L-2"></a> <span class="kp">attr_reader</span> <span class="ss">:code</span><span class="p">,</span> <span class="ss">:from</span><span class="p">,</span> <span class="ss">:to</span><span class="p">,</span> <span class="ss">:valid_from</span><span class="p">,</span> <span class="ss">:valid_to</span><span class="p">,</span> <span class="ss">:when_</span><span class="p">,</span> <span class="ss">:duration</span><span class="p">,</span> <span class="ss">:airplane</span><span class="p">,</span> <span class="ss">:distance</span><span class="p">,</span> <span class="ss">:base_price</span><span class="p">,</span> <span class="ss">:crew</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">from</span><span class="p">,</span> <span class="n">to</span><span class="p">,</span> <span class="n">valid_from</span><span class="p">,</span> <span class="n">valid_to</span><span class="p">,</span> <span class="n">when_</span><span class="p">,</span> <span class="n">duration</span><span class="p">,</span> <span class="n">airplane</span><span class="p">,</span> <span class="n">distance</span><span class="p">,</span> <span class="n">base_price</span><span class="p">,</span> <span class="n">crew</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a> <span class="vi">@code</span> <span class="o">=</span> <span class="n">code</span> </span><span id="L-5"><a name="L-5"></a> <span class="vi">@from</span> <span class="o">=</span> <span class="n">from</span> </span><span id="L-6"><a name="L-6"></a> <span class="vi">@to</span> <span class="o">=</span> <span class="n">to</span> </span><span id="L-7"><a name="L-7"></a> <span class="vi">@valid_from</span> <span class="o">=</span> <span class="n">valid_from</span> </span><span id="L-8"><a name="L-8"></a> <span class="vi">@valid_to</span> <span class="o">=</span> <span class="n">valid_to</span> </span><span id="L-9"><a name="L-9"></a> <span class="vi">@when_</span> <span class="o">=</span> <span class="n">when_</span> </span><span id="L-10"><a name="L-10"></a> <span class="vi">@duration</span> <span class="o">=</span> <span class="n">duration</span> </span><span id="L-11"><a name="L-11"></a> <span class="vi">@airplane</span> <span class="o">=</span> <span class="n">airplane</span> </span><span id="L-12"><a name="L-12"></a> <span class="vi">@distance</span> <span class="o">=</span> <span class="n">distance</span> </span><span id="L-13"><a name="L-13"></a> <span class="vi">@base_price</span> <span class="o">=</span> <span class="n">base_price</span> </span><span id="L-14"><a name="L-14"></a> <span class="vi">@crew</span> <span class="o">=</span> <span class="n">crew</span> </span><span id="L-15"><a name="L-15"></a> <span class="k">end</span> </span><span id="L-16"><a name="L-16"></a><span class="k">end</span> </span></pre></div> </td></tr></table>
seminarka