module Tablesalt::ClassPass
Public Instance Methods
class_pass_method(*methods, to: nil)
click to toggle source
# File lib/tablesalt/class_pass.rb, line 21 def class_pass_method(*methods, to: nil) methods.each do |method| next if _class_pass_methods.include?(method) _class_pass_methods << method define_singleton_method method do |*args, **attrs| if RUBY_VERSION < "2.7.0" && attrs.empty? new(*args).public_send(to || method) else new(*args, **attrs).public_send(to || method) end end end end
inherited(base)
click to toggle source
Calls superclass method
# File lib/tablesalt/class_pass.rb, line 14 def inherited(base) base._class_pass_methods = _class_pass_methods.dup super end