Sha256: 6bf9fcd8b753cc63ea9b4f4758556ecff7d4238c518fc46c5e7cd6f3d66fb10f

Contents?: true

Size: 538 Bytes

Versions: 12

Compression:

Stored size: 538 Bytes

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'ernie'

module Ext
  # Add two numbers together
  def add(a, b)
    a + b
  end

  def fib(n)
    if n == 0 || n == 1
      1
    else
      fib(n - 1) + fib(n - 2)
    end
  end

  def shadow(x)
    "ruby"
  end

  # Return the given number of bytes
  def bytes(n)
    'x' * n
  end

  # Sleep for +sec+ and then return :ok
  def slow(sec)
    sleep(sec)
    :ok
  end

  # Throw an error
  def error
    raise "abandon hope!"
  end
end

Ernie.expose(:ext, Ext)

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ernie-2.5.2 examples/ext.rb
ernie-2.5.1 examples/ext.rb
ernie-2.5.0 examples/ext.rb
ernie-2.4.0 examples/ext.rb
ernie-2.3.0 examples/ext.rb
ernie-2.2.1 examples/ext.rb
schleyfox-ernie-2.2.3 examples/ext.rb
schleyfox-ernie-2.2.2 examples/ext.rb
schleyfox-ernie-2.2.1 examples/ext.rb
ernie-2.2.0 examples/ext.rb
ernie-2.1.0 examples/ext.rb
ernie-2.0.0 examples/ext.rb