Sha256: b316c8db6ad6c912853de98c84de854df62610602c7bcd6928b1d0808cbc2180
Contents?: true
Size: 728 Bytes
Versions: 2
Compression:
Stored size: 728 Bytes
Contents
module Rlyeh module Utils class << self def singleton_class(obj) if obj.respond_to?(:singleton_class) obj.singleton_class else class << obj self end end end def extract_options(args) args.last.is_a?(::Hash) ? args.last : {} end def extract_options!(args) args.last.is_a?(::Hash) ? args.pop : {} end def generate_method(obj, name, method = nil, &block) name = name.to_s method ||= block obj.instance_eval do define_method name, &method method = instance_method name remove_method name method end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rlyeh-0.1.1 | lib/rlyeh/utils.rb |
rlyeh-0.0.2 | lib/rlyeh/utils.rb |