module BBLib::Delegator::ClassMethods
Public Instance Methods
_ancestor_delegate_fast()
click to toggle source
# File lib/bblib/core/mixins/delegator.rb, line 70 def _ancestor_delegate_fast ancestors.reverse.find do |anc| next if anc == self next unless anc.respond_to?(:delegate_fast) return anc.delegate_fast end true end
ancestor_delegates()
click to toggle source
# File lib/bblib/core/mixins/delegator.rb, line 83 def ancestor_delegates ancestors.reverse.flat_map do |anc| next if anc == self || !anc.respond_to?(:delegates) anc.delegates end.compact.uniq end
delegate_fast(*args)
click to toggle source
When turned on the respond_to_missing method is left unchanged. This GREATLY speeds up the instantiation of classes with lots of calls to respond_to?
# File lib/bblib/core/mixins/delegator.rb, line 57 def delegate_fast(*args) return @delegate_fast ||= _ancestor_delegate_fast if args.empty? @delegate_fast = args.first ? true : false end
delegate_to(*mthds)
click to toggle source
# File lib/bblib/core/mixins/delegator.rb, line 62 def delegate_to(*mthds) mthds.flatten.each do |method| next if delegates.include?(method) delegates << method end true end
delegates()
click to toggle source
# File lib/bblib/core/mixins/delegator.rb, line 79 def delegates @delegates ||= ancestor_delegates end