Sha256: 2efcae31ca6adfda251e09408d2dcb5a226beecf464a6abb24d491c5815d70d5
Contents?: true
Size: 931 Bytes
Versions: 1
Compression:
Stored size: 931 Bytes
Contents
module ActiveScripts class Package # INFO: ActiveScripts::Package contains code that is # for retrieving and validating packages. PACKAGES = Dir.entries("#{File.dirname(__FILE__)}/packages") .drop(2) .reject { |f| ["base.rb"].include?(f) } .map { |f| File.basename(f, ".rb") } attr_accessor :packages def initialize(packages=[]) @packages = packages end def self.find(packages=[]) new(packages).find end def find @packages.blank? ? say(" - Package skipped!") : assert_valid_packages! return(@packages.strip) end private def assert_valid_packages! @packages.each do |package| unless PACKAGES.include?(package) raise ArgumentError, "Unknown package: #{package.inspect}. Valid packages are listed in the documentation." end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_scripts-0.1.0 | lib/active_scripts/package.rb |