Sha256: 8893469f8767298b58c6c816ca35b6a309a51bb338b3bf67108e20c18811d8bc

Contents?: true

Size: 689 Bytes

Versions: 4

Compression:

Stored size: 689 Bytes

Contents

# -*- coding: utf-8 -*-

module Yaks
  class Mapper
    module ClassMethods
      include Forwardable
      include Util
      include FP

      CONFIG_METHODS = [
        :type,
        :attributes,
        :link,
        :profile,
        # :embed,
        :has_one,
        :has_many
      ]

      def config
        @config ||= Config.new nil, [], [], []
        @config = yield(@config) if block_given?
        @config
      end

      def inherited(child)
        child.config { @config }
      end

      CONFIG_METHODS.each do |method_name|
        define_method method_name do |*args|
          config &send_with_args(method_name, *args)
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yaks-0.4.2 lib/yaks/mapper/class_methods.rb
yaks-0.4.1 lib/yaks/mapper/class_methods.rb
yaks-0.4.0 lib/yaks/mapper/class_methods.rb
yaks-0.4.0.rc1 lib/yaks/mapper/class_methods.rb