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