Refactor CLI::Cat.

This commit is contained in:
Markus Reiter 2017-05-19 21:13:08 +02:00
parent 1714c73b49
commit 58db95c1d2
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,10 @@ module Hbc
def self.needs_init?
false
end
def initialize(*args)
@args = args
end
end
end
end

View File

@ -2,7 +2,11 @@ module Hbc
class CLI
class Cat < Base
def self.run(*args)
cask_tokens = cask_tokens_from(args)
new(*args).run
end
def run
cask_tokens = self.class.cask_tokens_from(@args)
raise CaskUnspecifiedError if cask_tokens.empty?
# only respects the first argument
cask_token = cask_tokens.first.sub(/\.rb$/i, "")