Skip to content

receives method should be defined as a singleton method on the singleton class #401

Closed
@catmando

Description

@catmando

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions