Skip to content
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

Update protection of private classes from direct use #336

Merged
merged 2 commits into from
Sep 5, 2017

Conversation

lbetz
Copy link
Contributor

@lbetz lbetz commented Jul 10, 2017

fixes #333

@baurmatt
Copy link
Contributor

Can't we just use assert_private?

@lbetz
Copy link
Contributor Author

lbetz commented Jul 10, 2017

Pretty good idea. We started with a much earlier version of stdlib without this function. Now we've a dependency on version 4.16.0... but I'm not sure that will fix the unit tests.

@baurmatt
Copy link
Contributor

baurmatt commented Aug 1, 2017

This is also a major improve when it comes to the icinga2::object class. The defined() variant is a lot slower then assert_private(). This is especillay import for setups which might include hundreds/thousands of icinga2::object's.

@baurmatt
Copy link
Contributor

baurmatt commented Aug 3, 2017

The problem with the tests is, that the assert_private() needs to be fake. This should do the trick:

  before(:each) do
    # Fake assert_private function from stdlib to not fail within this test
    Puppet::Parser::Functions.newfunction(:assert_private, :type => :rvalue) { |args|
    }
  end

@lazyfrosch lazyfrosch changed the title fix #333 protection of private classes is wrong Update protection of private classes from direct use Aug 28, 2017
@lazyfrosch lazyfrosch force-pushed the protection-of-private-classes-is-wrong-333 branch from 92f74f0 to 8320f30 Compare August 28, 2017 14:17
@lazyfrosch
Copy link
Contributor

Thanks @baurmatt, I incorporated your example

@lbetz lbetz self-assigned this Sep 4, 2017
@lbetz lbetz merged commit 16a317b into master Sep 5, 2017
@lbetz lbetz deleted the protection-of-private-classes-is-wrong-333 branch September 5, 2017 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

protection of private classes is wrong
3 participants