Remove redundant selfs.

This commit is contained in:
Markus Reiter 2016-10-14 20:55:09 +02:00
parent ad8ae33c1f
commit 9f513cc60c
2 changed files with 4 additions and 5 deletions

View File

@ -73,9 +73,8 @@ module Hbc
}.freeze }.freeze
def self.command_classes def self.command_classes
@command_classes ||= self.constants @command_classes ||= constants.map(&method(:const_get))
.map(&method(:const_get)) .select { |sym| sym.respond_to?(:run) }
.select { |sym| sym.respond_to?(:run) }
end end
def self.commands def self.commands
@ -114,7 +113,7 @@ module Hbc
# for development and troubleshooting # for development and troubleshooting
sym = Pathname.new(command.to_s).basename(".rb").to_s.capitalize sym = Pathname.new(command.to_s).basename(".rb").to_s.capitalize
klass = begin klass = begin
self.const_get(sym) const_get(sym)
rescue NameError rescue NameError
nil nil
end end

View File

@ -59,7 +59,7 @@ module Hbc
def self.from_type(type) def self.from_type(type)
odebug "Determining which containers to use based on 'container :type'" odebug "Determining which containers to use based on 'container :type'"
begin begin
self.const_get(type.to_s.split("_").map(&:capitalize).join) const_get(type.to_s.split("_").map(&:capitalize).join)
rescue NameError rescue NameError
false false
end end