module NxtSupport::Services::Base::ClassMethods
Public Instance Methods
class_interface(config = :call)
click to toggle source
# File lib/nxt_support/services/base.rb, line 5 def class_interface(config = :call) if config.is_a?(Symbol) define_singleton_method config do |*args, **opts| build_instance(*args, **opts).send(config) end else raise ArgumentError, "Wrong configuration. Please use 'class_interface :your_method_name'" end end
Private Instance Methods
build_instance(*args, **opts)
click to toggle source
Ruby <2.7-specific check. If the gem is updated to 2.7, `**opts` will work.
# File lib/nxt_support/services/base.rb, line 18 def build_instance(*args, **opts) if opts.empty? new(*args, **{}) else new(*args, **opts) end end