-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Encountered while writing up some small benchmarks:
class RefinedFibber
end
module FibRefinement
# using FibRefinement # without this we cannot recurse
refine(RefinedFibber) do
def fib_recursive(a)
a < 2 ? a : fib_recursive(a - 1) + fib_recursive(a - 2)
end
end
end
class RefinedFibberUser
using FibRefinement
def initialize
@refined_fibber = RefinedFibber.new
end
def fib_recursive(a)
@refined_fibber.fib_recursive(a)
end
end
RefinedFibberUser.new.fib_recursive(30) # => NoMethodErrorThe annotated line here is necessary for the refinement to see its own methods. This is likely the cause of various small refinement bugs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels