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

set @root_class only if it is not already set by subclass #5658

Merged
merged 1 commit into from May 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/presenters/tree_builder_vms_filter.rb
@@ -1,6 +1,6 @@
class TreeBuilderVmsFilter < TreeBuilder
def initialize(*args)
@root_class = 'ManageIQ::Providers::InfraManager::Vm'
@root_class ||= 'ManageIQ::Providers::InfraManager::Vm'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this can be previously set 😞

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TreeBuilderImagesFilter, TreeBuilderVmsInstancesFilter, TreeBuilderInstancesFilter, TreeBuilderTemplatesImagesFilter and TreeBuilderTemplateFilter all set @root_class before calling super in the constructor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skateman do you want this changed, or are you ok with this as is?

(We could probably just move the assignment after super in all the classes, solving the problem too.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, yes constructor redefinition call order, sure I'm fine

super(*args)
end

Expand Down