GithubHelp home page GithubHelp logo

andyobtiva / super_module Goto Github PK

View Code? Open in Web Editor NEW
140.0 5.0 4.0 187 KB

SuperModule allows defining class methods and method invocations the same way a super class does without using def included(base). This also succeeds ActiveSupport::Concern by offering lighter syntax

License: MIT License

Ruby 100.00%
ruby supermodule extension mixin rails mixins

super_module's Issues

cannot delete records

I can't seem to destroy records using the activerecord destroy method. If I stop using supermodule then everything works as expected.

super_module :Confirmation do
  include ActiveModel::Model
  include AASM

  <lots of activemodel methods>

end

improving 'include SuperModule'

Looks like a great project!
One thing that came to my mind is the requirement that include SuperModule has to be the class first include . It seems likely that other users working on a shared project can add more includes before this first include without realising they are breaking things . (its true that usually people add includes to the end and not to the top , but can we really base everything on that assumption?).
I can try finding a solution if you think it's worth it.

How does it work?

Could you provide a description of how this works in the README?

I looked over the code briefly, and it appears to copy the singleton methods of the super module to the module the super module is included in. Is that correct?

Note: I have always thought this should the common behavior of module inclusion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.