Sha256: 8e1b514f3c0922e96ef2d413c5396216434c0336db17c58eb1ec3cd246b6c940

Contents?: true

Size: 433 Bytes

Versions: 5

Compression:

Stored size: 433 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
end

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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
mojombo-ernie-0.3.4 examples/calc.rb
ernie-1.0.0 examples/calc.rb
ernie-0.4.0 examples/calc.rb
ernie-0.3.5 examples/calc.rb
ernie-0.3.4 examples/calc.rb