Sha256: 658fdcca71e3e62fef7bca351e45a9028f73aaabd2d28c4dab2fc7ea0aac78cb

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

module BusinessCentral
  module Object
    module ObjectHelper
      using Refinements::Strings

      def method_missing(object_name, **params)
        if BusinessCentral::Object.const_defined?(object_name.to_s.to_class_sym)
          klass = BusinessCentral::Object.const_get(object_name.to_s.to_class_sym)
          klass.new(self, **params)
        else
          BusinessCentral::Object::Base.new(self, **params.merge!({ object_name: object_name }))
        end
      end

      def respond_to_missing?(_object_name, _include_all)
        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
business-central-2.0.0 lib/business_central/object/object_helper.rb