Sha256: d21db72a5221b801222d696de2e9bd51bafef34ce198320fd5a8d7eb427d98e2

Contents?: true

Size: 536 Bytes

Versions: 2

Compression:

Stored size: 536 Bytes

Contents

module ActiveAdapter
  class Implement
    class << self
      attr_accessor :abstract_adapter
    end

    delegate :abstract_adapter, to: :class

    def method_missing(method, *_args)
      # 抽象适配器定义的方法,适配器未实现,则提示未实现异常
      super unless abstract_adapter.public_instance_methods.include?(method)
      raise ActiveAdapter::MethodNotImplementError, "#{method} - #{self.class.name}"
    end

    def respond_to_missing?(method, include_private = false)
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_adapter-0.1.0 lib/active_adapter/implement.rb
active_adapter-0.1.0.pre lib/active_adapter/implement.rb