New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract security from Decorator #305
Conversation
We don't need to deny `Object` methods or `method_missing` because `Decorator` will respond to these itself so * `Decorator#respond_to?` will hit `super` and return true, as expected * `Decorator#method_missing` will not be called for these methods, so we will never check whether they are denied anyway!
|
Just looking at the diffs, I like it. |
|
not sure, but looks like a module to me. |
|
@nashby agreed, I was reading a bit fast. A module is the right conceptual move and would not need the proxy stubs in |
|
Yep, agreed, I'll change it. |
|
Yeah, you guys were right, this is nicer now. Let me know if you want me to rebase. |
|
@haines awesome, thanks! Let's wait for @steveklabnik |
|
Oh no! When I saw this title, I was like "I bet it's a module, can I bother him to ask for it as a class?" |
|
Yes, I would prefer the class version very much. "Prefer composition over inheritance." Can you drop b5cc216? |
|
Haha oh dear. I liked the module version because it's less code, but I guess less code != better code :) |
|
Looking at it again, I think I'm landing back on the class side of the fence. I like that the class version has the Also, the class option hides the private bits properly - |
Modules
Classes
So, which should we use? Note that a |
I've developed the same knee-jerk reaction. Overuse of modules for "separation of concerns" has become so common that we can name it: http://stevenharman.net/bag-of-methods-module-and-grep-driven-development |
|
I wrote about this too: http://blog.steveklabnik.com/posts/2012-05-07-mixins--a-refactoring-anti-pattern That said, I also talked to @nashby, and he is |
|
Ah yes... I remember that post. Well done. And |
|
Sweet as, should be good to merge! @stevenharman I love "grep-driven development" Edit: in case that was ambiguous, I love the term "grep-driven development". I do not love grep-driven development itself :) |
Extract security from Decorator
|
|
I feel like
Decoratoris doing quite a number of different things, and perhaps some of it could be nicely extracted. Thedenies/allowslogic seemed like a good place to start as it was a little bit hacky anyway.