Closed
Description
The receives
method can be used as a class method or an instance method, but not as singleton method on the class:
class SomeComponent < HyperComponent
after_mount do
receives(SomeOperation) { ...self is an instance in here... }
end
receives(SomeOperation) { ... self is the class in here ... }
class << self
def some_class_method
end
receives(SomeOperation) { ... doesn't work! ... }
end
end
The third case should just set up the receiver at the class level so that things read better.
Otherwise, if you are defining a bunch of class methods, and need to have a receiver at the class level, you
have to step outside the singleton class, to set the receiver up.