Sha256: 0677e31cf7ed59437dd94600461cb92b8ba747d6622a00710af7279a87610176
Contents?: true
Size: 605 Bytes
Versions: 35
Compression:
Stored size: 605 Bytes
Contents
require 'delorean/const' module Delorean module Model def self.included(base) base.send :extend, ClassMethods end module ClassMethods def delorean_fn(name, options = {}, &block) define_singleton_method(name) do |*args| block.call(*args) end sig = options[:sig] raise "no signature" unless sig if sig sig = [sig, sig] if sig.is_a? Fixnum raise "Bad signature" unless (sig.is_a? Array and sig.length==2) self.const_set(name.to_s.upcase+Delorean::SIG, sig) end end end end end
Version data entries
35 entries across 35 versions & 1 rubygems