Enable typing in Cask::Cmd::AbstractCommand

This commit is contained in:
Douglas Eichelberger 2023-02-27 14:19:09 -08:00
parent d98b7845d3
commit 6611a03cc6

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "search" require "search"
@ -40,12 +40,12 @@ module Cask
sig { returns(String) } sig { returns(String) }
def self.command_name def self.command_name
@command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase @command_name ||= T.must(name).sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
end end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def self.abstract? def self.abstract?
name.split("::").last.match?(/^Abstract[^a-z]/) T.must(name).split("::").fetch(-1).match?(/^Abstract[^a-z]/)
end end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
@ -58,11 +58,6 @@ module Cask
parser.generate_help_text parser.generate_help_text
end end
sig { returns(String) }
def self.short_description
description[/\A[^.]*\./]
end
def self.run(*args) def self.run(*args)
new(*args).run new(*args).run
end end