Sha256: aa68be7b11a620a077fdb59ae185bf3f38ceb3e5b746d9d5fb016693cc922265
Contents?: true
Size: 430 Bytes
Versions: 58
Compression:
Stored size: 430 Bytes
Contents
# encoding: utf-8 module FromFile module ClassMethods def from_file(path) new.tap do |obj| obj.from_file(path) end end end def from_file(path) if File.exists?(path) && File.readable?(path) self.instance_eval(IO.read(path), path, 1) else raise IOError, "Cannot open or read #{path}!" end end def self.included(receiver) receiver.extend(ClassMethods) end end
Version data entries
58 entries across 58 versions & 2 rubygems