diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-11-19 12:10:36 -0600 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-11-19 12:10:36 -0600 |
commit | dd3cea4ef6fc759543c6457e419c31dc7df6140a (patch) | |
tree | 88c151942418e2d686e7637c92e9c1c63f327e15 /app/lib/command_tag/commands.rb | |
parent | 930f7145374adb79e92e9bdfcbc0d0044690b6c8 (diff) |
More robust loading of command interpreter modules
Diffstat (limited to 'app/lib/command_tag/commands.rb')
-rw-r--r-- | app/lib/command_tag/commands.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/lib/command_tag/commands.rb b/app/lib/command_tag/commands.rb index f27486427..068c8bb66 100644 --- a/app/lib/command_tag/commands.rb +++ b/app/lib/command_tag/commands.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true -Dir[File.join(__dir__, 'command', '*.rb')].sort.each { |file| require file } - module CommandTag::Commands def self.included(base) - CommandTag::Command.constants.map(&CommandTag::Command.method(:const_get)).grep(Module) do |mod| - base.include(mod) + Dir[File.join(__dir__, 'commands', '*.rb')].sort.each do |file| + require file + base.include(CommandTag::Commands.const_get(File.basename(file).gsub('.rb', '').split('_').map(&:capitalize).join)) end end end |