This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# module FooBar | |
# extend DelegatedModuleFunction | |
# | |
# define_delegated_module_functions do | |
# | |
# def foo_bar | |
# 'Foo' + bar | |
# end | |
# | |
# private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SingletonWithClassDelegator | |
extend ActiveSupport::Concern | |
included do | |
include Singleton | |
original_delegate_method = method(:delegate).unbind if self.respond_to?(:delegate) | |
extend SingleForwardable | |
if original_delegate_method.present? | |
# restore the delegate of ActiveSupport that has been overshadowed by SingleForwardable | |
define_singleton_method :delegate, original_delegate_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const Sequelize = require('sequelize'); | |
const Promise = Sequelize.Promise; | |
const DEFAULT_BATCH_SIZE = 3000; | |
/** | |
* Port of ActiveRecord::Base.find_each of Rails. |
OlderNewer