-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Decorum can be hard to develop with because it consumes method_missing errors from further down the call stack. For example, this happens to me a lot:
class House
include Decorum::Decorations
# note: no `is_couch?` method
end
class InteriorDecorator < Decorum::Decorator
def couch
object.furniture.detect { |f| f.is_couch? }
end
end
h = House.new
h.decorate(InteriorDecorator)
# Expected: ⇣
h.couch #=> NoMethodError: undefined method `is_couch?` for #<House:0x007fe054553750>
# Actual:
h.couch #=> NoMethodError: undefined method `couch' for #<House:0x007fe054553750>Dropping a byebug call in couch results in halting execution at the expected point, and causing a method_missing error during the debugging session actually breaks out of it.
Any insight as to how this could be avoided?
Edit: I know, I'm a bad person for using puns in example code and making concepts harder to grok. Sorry.
Metadata
Metadata
Assignees
Labels
No labels