Skip to content

Instantly share code, notes, and snippets.

@richardpeng
Created October 30, 2018 18:03
Show Gist options
  • Save richardpeng/d95387e98b243fc614f673d60eaf0c30 to your computer and use it in GitHub Desktop.
Save richardpeng/d95387e98b243fc614f673d60eaf0c30 to your computer and use it in GitHub Desktop.
Inherit both class and instance methods from another module with a single include
module GraphQL
module PunditIntegration
module BaseIntegration
def self.included(child)
child.extend ClassMethods
end
module ClassMethods
def policy_class
end
end
def pundit_role
end
end
module MutationIntegration
def self.included(child)
child.include GraphQL::PunditIntegration::BaseIntegration
child.extend ClassMethods
end
module ClassMethods
end
end
end
end
class MyClass
include GraphQL::PunditIntegration::MutationIntegration
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment