Class: HammerCLI::Subcommand::LazyDefinition
- Inherits:
-
Definition
- Object
- Clamp::Subcommand::Definition
- Definition
- HammerCLI::Subcommand::LazyDefinition
- Defined in:
- lib/hammer_cli/subcommand.rb
Instance Attribute Summary
Attributes inherited from Definition
Instance Method Summary collapse
-
#initialize(names, description, subcommand_class_name, path, options = {}) ⇒ LazyDefinition
constructor
A new instance of LazyDefinition.
- #loaded? ⇒ Boolean
- #subcommand_class ⇒ Object
Methods inherited from Definition
Constructor Details
#initialize(names, description, subcommand_class_name, path, options = {}) ⇒ LazyDefinition
Returns a new instance of LazyDefinition.
37 38 39 40 41 |
# File 'lib/hammer_cli/subcommand.rb', line 37 def initialize(names, description, subcommand_class_name, path, = {}) super(names, description, subcommand_class_name, ) @loaded = false @path = path end |
Instance Method Details
#loaded? ⇒ Boolean
43 44 45 |
# File 'lib/hammer_cli/subcommand.rb', line 43 def loaded? @loaded end |
#subcommand_class ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hammer_cli/subcommand.rb', line 47 def subcommand_class unless @loaded require @path @loaded = true @constantized_class = @subcommand_class.constantize end @warning ||= @constantized_class.warning warn(@warning) if @warning @constantized_class end |