Sha256: 131db85c60f1c16b689c2ec406059bfb886ffa62baf2c9950b530ad8d2559108

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

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

# Just about the easiest example I could thing of.
mod(:calc) do
  fun(:add) do |a, b|
    a + b
  end
end

# Useful for tests that need to simulate longer running functions.
mod(:slowcalc) do
  fun(:add) do |a, b|
    sleep(rand * 2)
    a + b
  end

  fun(:superslow) do
    sleep 10
  end
end

# Throw an error
mod(:errorcalc) do
  fun(:add) do |a, b|
    raise "abandon hope!"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ernie-1.1.0 examples/calc.rb