lib/hammer_cli/subcommand.rb in hammer_cli-0.16.0 vs lib/hammer_cli/subcommand.rb in hammer_cli-0.17.0
- old
+ new
@@ -16,10 +16,11 @@
def hidden?
@hidden
end
def subcommand_class
+ @warning ||= @subcommand_class.warning
warn(@warning) if @warning
@subcommand_class
end
attr_reader :warning
@@ -36,15 +37,16 @@
def loaded?
@loaded
end
def subcommand_class
- warn(@warning) if @warning
- if !@loaded
+ unless @loaded
require @path
@loaded = true
@constantized_class = @subcommand_class.constantize
end
+ @warning ||= @constantized_class.warning
+ warn(@warning) if @warning
@constantized_class
end
end
def self.included(base)