-
Notifications
You must be signed in to change notification settings - Fork 30
Code cleanup for code climate #38
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
Conversation
lib/linux_admin/common.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really belong in LinuxAdmin::Common? I'm thinking it might be better to have a Volume class that acts as a base class for LogicalVolume and PhysicalVolume.
Why were all of the described_class calls undone? |
lib/linux_admin/common.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@movitto Does it make sense to process each line in a method? You might have to splat the *process_volume_display_line.
def self.process_volume_display_line(line)
fields = line.split(':')
vgname = fields[1]
vg = vgs.find { |vg| vg.name == vgname }
return fields, vg
end
def self.scan_volumes(cmd)
# ...
out.each_line do |line|
fields, vg = process_volume_display_line(line)
lvs << yield(fields, vg)
end
lvs
end
@movitto This looks really good so far. As long as we bury the complicated logic like what 8-10 columns in a fstab line mean in a nicely named method, the callers don't have to care the order of those columns or if they are chomped, split, and String/Fixnums, etc. |
This PR is not mergable, Please rebase and repush. |
Code cleanup for code climate
No description provided.