app/libs/agilibox/monkey.rb in agilibox-1.11.0 vs app/libs/agilibox/monkey.rb in agilibox-2.0.0

- old
+ new

@@ -1,31 +1,31 @@ module Agilibox::Monkey extend ActiveSupport::Concern class_methods do - def prepend_instances(&block) - m = Module.new(&block) + def prepend_instances(&) + m = Module.new(&) send(:prepend, m) end - def prepend_class(&block) - m = Module.new(&block) + def prepend_class(&) + m = Module.new(&) singleton_class.send(:prepend, m) end - def prepend_instance_method(name, &block) + def prepend_instance_method(name, &) check_instance_method_exist!(name) m = Module.new - m.send(:define_method, name, &block) + m.send(:define_method, name, &) send(:prepend, m) end - def prepend_class_method(name, &block) + def prepend_class_method(name, &) check_class_method_exist!(name) m = Module.new - m.send(:define_method, name, &block) + m.send(:define_method, name, &) singleton_class.send(:prepend, m) end def check_instance_method_exist!(name) raise "instance method `#{name}` does not exist" unless instance_methods.include?(name)