Sha256: 0d09e4b928ef4e49b9d0768f439097e2813e6b1af19533525d2535e068177522
Contents?: true
Size: 548 Bytes
Versions: 1
Compression:
Stored size: 548 Bytes
Contents
require "behavioral/version" module Behavioral def with_behaviors(*mods) Array(mods).each do |mod| mod.instance_methods.each do |meth| instance_exec(meth, mod.instance_method(meth)){|m, unbound_method| define_singleton_method m, unbound_method } end end self end def without_behaviors(*mods) Array(mods).each do |mod| mod.instance_methods.each do |meth| singleton_class.send(:remove_method, meth) if singleton_methods.include?(meth) end end self end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
behavioral-1.0.0 | lib/behavioral.rb |