Sha256: 59e1585d08324199dcd3fc3d4908736df1a9b85dd20b67781cedabc5b8170a16

Contents?: true

Size: 586 Bytes

Versions: 11

Compression:

Stored size: 586 Bytes

Contents

module APIClientBase
  module Client
    module Attributes

      def self.included(base)
        base.include Virtus.model
        inherit_attributes!(base)
      end

      private

      def self.inherit_attributes!(klass)
        parent_module = klass.name.deconstantize.constantize
        return unless parent_module.respond_to?(:configuration)
        parent_module.configuration.rules.each do |rule|
          self.inherit_attribute!(klass, rule)
        end
      end

      def self.inherit_attribute!(klass, rule)
        klass.attribute rule[0]
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
api_client_base-1.10.0 lib/api_client_base/client/attributes.rb
api_client_base-1.9.0 lib/api_client_base/client/attributes.rb
api_client_base-1.8.0 lib/api_client_base/client/attributes.rb
api_client_base-1.7.0 lib/api_client_base/client/attributes.rb
api_client_base-1.6.0 lib/api_client_base/client/attributes.rb
api_client_base-1.5.0 lib/api_client_base/client/attributes.rb
api_client_base-1.4.1 lib/api_client_base/client/attributes.rb
api_client_base-1.4.0 lib/api_client_base/client/attributes.rb
api_client_base-1.3.0 lib/api_client_base/client/attributes.rb
api_client_base-1.2.0 lib/api_client_base/client/attributes.rb
api_client_base-1.1.0 lib/api_client_base/client/attributes.rb