Sha256: 6dd228e7c41abdc00c9a6363e0f7952f0d1661dc0c82a27d734dceb1c976b4db
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Assay #VERSION="1.0.0" # Returns a Hash table of failure classes indexed by # asserton operator. def self.failure_classes_by_operator @_failure_classes_by_operator ||= ( c = {} ObjectSpace.each_object(Class) do |fc| next unless fc < Assay::Assertion if fc.respond_to?(:assertion_operator) c[fc.assertion_operator.to_sym] = fc end end c ) end # Lookup failure class by operator. def self.lookup(operator) failure_classes_by_operator[operator.to_sym] end # Returns Hash table of project metadata. def self.meta @spec ||= ( require 'yaml' YAML.load(File.new(File.dirname(__FILE__) + '/assay.yml')) ) end # Check metadata for missing constants. def self.const_missing(name) meta[name.to_s.downcase] || super(name) end end # Load Assay's failure classes. dir = File.dirname(__FILE__) glob = File.join(dir, 'assay', 'assertions', '*.rb') Dir[glob].each do |rb| require 'assay/assertions/' + File.basename(rb) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
assay-0.3.0 | lib/assay.rb |
assay-0.2.0 | lib/assay.rb |