Skip to content

Use regex to match necessary methods #24

@id777

Description

@id777

Hello!
Is there way to point on methods with regex or mask? Example:
after /base/ do |*, team| team.save end

In class i usually have several base methods which names started from certain word ("base_*", for example).
And i wanted use callbacks to my base methods, and not use for others methods.

UPD: It seems like i found a way to do it:
after(self.instance_methods(false).grep(/base/)) do ... end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions