Methods
A
C
F
N
Included Modules
Attributes
[R] fib_calls
Class Public methods
new()
# File activesupport/test/memoizable_test.rb, line 90
def initialize
  @fib_calls = 0
end
Instance Public methods
add_or_subtract(i, j, add)
# File activesupport/test/memoizable_test.rb, line 105
def add_or_subtract(i, j, add)
  if add
    i + j
  else
    i - j
  end
end
counter()
# File activesupport/test/memoizable_test.rb, line 114
def counter
  @count ||= 0
  @count += 1
end
fib(n)
# File activesupport/test/memoizable_test.rb, line 94
def fib(n)
  @fib_calls += 1

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