diff options
Diffstat (limited to 'app/lib/command_tag')
-rw-r--r-- | app/lib/command_tag/commands/hello_world.rb | 2 | ||||
-rw-r--r-- | app/lib/command_tag/processor.rb | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/app/lib/command_tag/commands/hello_world.rb b/app/lib/command_tag/commands/hello_world.rb index d67f65333..cc770ef80 100644 --- a/app/lib/command_tag/commands/hello_world.rb +++ b/app/lib/command_tag/commands/hello_world.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module CommandTag::Commands::HelloWorld - def initialize_helloworld! + def handle_helloworld_startup @vars['hello_world'] = ['Hello, world!'] end diff --git a/app/lib/command_tag/processor.rb b/app/lib/command_tag/processor.rb index cb447f851..414c08638 100644 --- a/app/lib/command_tag/processor.rb +++ b/app/lib/command_tag/processor.rb @@ -49,7 +49,7 @@ class CommandTag::Processor reset_status_caches - initialize_handlers! + all_handlers!(:startup) parse_statements @@ -79,13 +79,14 @@ class CommandTag::Processor end execute_statements(:at_end) + all_handlers!(:shutdown) reset_status_caches end private - def initialize_handlers! - self.class.instance_methods.grep(/\Ainitialize_\w+!\z/).each do |name| + def all_handlers!(affix) + self.class.instance_methods.grep(/\Ahandle_\w+_#{affix}\z/).each do |name| public_send(name) end end |