homebrew-cask-versions/lib/cask/source/path.rb
phinze ca0dbf84a6 pull cask loading out into classes
- introduce Cask::Source to encapsulate different types of loading
   behind a consistent interface
 - mostly this is method-level reorg, kept refactoring of the internals
   of these methods to a minimum for this pass
 - this is preparatory cleanup for adding the ability to represent a
   cask without a backing ruby file
2013-11-16 13:40:51 -06:00

21 lines
347 B
Ruby

class Cask::Source::Path
def self.me?(query)
File.file?(query)
end
attr_reader :path
def initialize(path)
@path = Pathname(path).expand_path
end
def load
require path
Cask.const_get(cask_class_name).new
end
def cask_class_name
path.basename.to_s.sub(/\.rb/, '').split('-').map(&:capitalize).join
end
end