Sha256: fd4065fb964bf2239aacb4890d1a61dcd550423af6260e0e325c6ec7f888287c
Contents?: true
Size: 708 Bytes
Versions: 8
Compression:
Stored size: 708 Bytes
Contents
require 'awesome_print' module Babelyoda module SpecificationLoader def self.included(klass) klass.extend ClassMethods end def initialize(*args) super yield(self) if block_given? end def method_missing(method_name, *args, &block) msg = "You tried to call the method #{method_name}. There is no such method." raise msg end def dump ap self, :indent => -2 end module ClassMethods def load_from_file(filename) return nil unless File.exist?(filename) spec = eval(File.read(filename)) raise "Wrong specification class: #{spec.class.to_s}" unless spec.instance_of?(self) return spec end end end end
Version data entries
8 entries across 8 versions & 1 rubygems