<commit_before>---
layout: default
---

<section class='hero'>
  <div class='wrapper'>
    <h1 class='hero-intro'>FiniteMachine is a minimal finite state machine with a straightforward and intuitive syntax.</h1>

    <div class="browser-window">
      <div class='top-bar'>
        <div class="circles">
          <div class="circle circle--red"></div>
          <div class="circle circle--yellow"></div>
          <div class="circle circle--green"></div>
        </div>
      </div>
      <div class="browser-container">
        <div class="line-numbers">
          <ol><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li><li>13</li><li>14</li><li>15</li><li>16</li><li>17</li></ol>
        </div>
        <div class="window-content">
{% highlight ruby %}
fm = FiniteMachine.new do
  initial :red

  event :ready, :red    => :yellow
  event :go,    :yellow => :green
  event :stop,  :green  => :red

  on_before(:ready) { |event| ... }
  on_after(:go)     { |event| ... }
  on_enter(:yellow) { |event| ... }
  on_transition     { |event| ... }
  on_exit(:green)   { |event| ... }
end

fm.state # => :red
fm.ready
fm.state # => :yellow
{% endhighlight %}
        </div>
      </div>
    </div>
  </div>
</section>

<section class='features'>
  <div class='wrapper'>
    <div class='feature-items'>
      <h2 class='title'>Powerful state machine features </h2>
      <div class='feature-item'>
        <div class='feature-icon'>
          <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
          <path d="M256,50c-57.861,49.195-96.167,57-156.5,57c0,0,0,116.921,0,192.528c0,79,56.996,99.629,156.5,162.472 c99.504-62.843,156.5-83.472,156.5-162.472c0-75.607,0-192.528,0-192.528C352.167,107,313.861,99.195,256,50z M158.067,348.581 c-11.145-11.566-18.567-24.334-18.567-49.053v-41.445H256V100.867c40.768,29.345,75.684,40.771,116.5,44.536v112.68H256v156.812 C211.745,387.728,177.041,368.271,158.067,348.581z"/>
          </svg>
        </div>
        <h2>ORM agnostic</h2>
        <p>Value flexibility and maintainabilty? Since FiniteMachine is just an object it allows for easy integration with the rest of the system.</p>
      </div>
      <div class='feature-item'>
        <div class='feature-icon'>
        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
        <path d="M379.417,142.776H133.583v25h245.834V142.776z M379.417,187.776H133.583v25h245.834V187.776z M379.417,232.776H133.583v25h245.834V232.776z M252,277.776H133.583v25H252V277.776z M50,63.237v318.525h412V63.237H50z M419.891,339.654H92.109l-0.001-234.308l327.782-0.002V339.654z M314.393,406.655l42.107,42.107h-201l42.107-42.107H314.393z"/><commit_msg>Change to use current in finite_machine example<commit_after>---
layout: default
---

<section class='hero'>
  <div class='wrapper'>
    <h1 class='hero-intro'>FiniteMachine is a minimal finite state machine with a straightforward and intuitive syntax.</h1>

    <div class="browser-window">
      <div class='top-bar'>
        <div class="circles">
          <div class="circle circle--red"></div>
          <div class="circle circle--yellow"></div>
          <div class="circle circle--green"></div>
        </div>
      </div>
      <div class="browser-container">
        <div class="line-numbers">
          <ol><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li><li>13</li><li>14</li><li>15</li><li>16</li><li>17</li></ol>
        </div>
        <div class="window-content">
{% highlight ruby %}
fm = FiniteMachine.new do
  initial :red

  event :ready, :red    => :yellow
  event :go,    :yellow => :green
  event :stop,  :green  => :red

  on_before(:ready) { |event| ... }
  on_after(:go)     { |event| ... }
  on_enter(:yellow) { |event| ... }
  on_transition     { |event| ... }
  on_exit(:green)   { |event| ... }
end

fm.current # => :red
fm.ready
fm.current # => :yellow
{% endhighlight %}
        </div>
      </div>
    </div>
  </div>
</section>

<section class='features'>
  <div class='wrapper'>
    <div class='feature-items'>
      <h2 class='title'>Powerful state machine features </h2>
      <div class='feature-item'>
        <div class='feature-icon'>
          <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
          <path d="M256,50c-57.861,49.195-96.167,57-156.5,57c0,0,0,116.921,0,192.528c0,79,56.996,99.629,156.5,162.472 c99.504-62.843,156.5-83.472,156.5-162.472c0-75.607,0-192.528,0-192.528C352.167,107,313.861,99.195,256,50z M158.067,348.581 c-11.145-11.566-18.567-24.334-18.567-49.053v-41.445H256V100.867c40.768,29.345,75.684,40.771,116.5,44.536v112.68H256v156.812 C211.745,387.728,177.041,368.271,158.067,348.581z"/>
          </svg>
        </div>
        <h2>ORM agnostic</h2>
        <p>Value flexibility and maintainabilty? Since FiniteMachine is just an object it allows for easy integration with the rest of the system.</p>
      </div>
      <div class='feature-item'>
        <div class='feature-icon'>
        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
        <path d="M379.417,142.776H133.583v25h245.834V142.776z M379.417,187.776H133.583v25h245.834V187.776z M379.417,232.776H133.583v25h245.834V232.776z M252,277.776H133.583v25H252V277.776z M50,63.237v318.525h412V63.237H50z M419.891,339.654H92.109l-0.001-234.308l327.782-0.002V339.654z M314.393,406.655l42.107,42.107h-201l42.107-42.107H314.393z"/>
{'fraction_non_alphanumeric': 0.2039344262295082, 'fraction_numerical': 0.19934426229508198, 'mean_word_length': 3.28140350877193, 'pattern_counts': {'":': 0, '<': 163, '<?xml version=': 0, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5160128', 'n_tokens_mistral': 3189, 'n_tokens_neox': 2426, 'n_words': 371}