Sha256: 6a482b9baaef009270f7ced8498784bf1577e1ec6a5b3998483293be066aa068

Contents?: true

Size: 671 Bytes

Versions: 6

Compression:

Stored size: 671 Bytes

Contents

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

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

      CONFIG_METHODS = [
        :type,
        :attributes,
        :link,
        :profile,
        :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

6 entries across 6 versions & 2 rubygems

Version Path
yaks-0.6.0.alpha.1 lib/yaks/mapper/class_methods.rb
yaks-html-0.6.0.alpha yaks/lib/yaks/mapper/class_methods.rb
yaks-0.6.0.alpha yaks/lib/yaks/mapper/class_methods.rb
yaks-0.5.0 lib/yaks/mapper/class_methods.rb
yaks-0.4.4 lib/yaks/mapper/class_methods.rb
yaks-0.4.3 lib/yaks/mapper/class_methods.rb