Sha256: 3f1dfdafee073869c969eb668c415d27e4ed64182411f10366fc46d9e9a50b74

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

desc: A illustrative format.

code: |
  # Returns a random, but pronounceable, name.
  def generate_name
    letters = ('a'..'z').to_a - %w[ c q w x ] # redundant sounds
    vowels = %w[a e i o u]
    consonants = letters - vowels
    sets = [consonants, vowels]

    length = 3 + rand(5)

    name = ''
    length.times do |i|
      set = sets[i % sets.length]
      name << set[rand(set.length)]
    end

    name
  end

  class Node
    def name
      @name ||= generate_name
    end
  end

nodes:
  hello:
    index: true
    number: true
    silent: false
    output: |
      <h1><%= @node.type %> #<%= @node.index %>: <%= @node.name.inspect %></h1>
      My name is <%= @node.name.inspect %> and these are my properties:
      <table>
        <tr>
          <th>Property</th>
          <th>Value</th>
        </tr>
        <tr>
          <td>args</td>
          <td><%= @node.args.inspect %></td>
        </tr>
        <tr>
          <td>index</td>
          <td><%= @node.index.inspect %></td>
        </tr>
        <tr>
          <td>number</td>
          <td><%= @node.number.inspect %></td>
        </tr>
        <tr>
          <td>trace</td>
          <td><ul><%= @node.trace.map {|s| "<li>#{s}</li>"} %></ul></td>
        </tr>
        <tr>
          <td>content</td>
          <td><%= @node.content %></td>
        </tr>
      </table>

output: |
  Welcome to the "<%= @spec[:name] %>" format.
  <div style="<%= $style %>"><%= @content %></div>
  That's all folks!

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gerbil-2.0.0 doc/HelloWorld.spec
gerbil-2.1.0 doc/HelloWorld.spec
gerbil-3.0.0 doc/HelloWorld.spec
gerbil-1.1.0 doc/HelloWorld.spec
gerbil-1.0.0 doc/HelloWorld.spec
gerbil-3.0.2 doc/HelloWorld.spec
gerbil-3.0.1 doc/HelloWorld.spec